2. Strolling in Jungle

Introduction

You are going to learn how to program your own animation!

Step 1: Animating your monkey

Let’s make our monkey stroll in the jungle and go under the tree.

Activity Checklist

First, open up the AdamaScript IDE. And we will choose a background from Nature section and ‘tree’ backdrop.

Click ‘File’ and then Save Project now to save your project. Give it a name, Strolling in jungle.

 

Step 2: Animating using loops

 Activity Checklist

Another way of animating the Monkey is to tell it to move a small amount, lots of times.

The repeat block is used to repeat something lots of times and is also known as a loop.

Now we will see what Motion blocks do.

First, we will take move 10 steps block and press it. See your monkey moves a bit!

   

 

Now we can do it in two ways. First using the move blocks, changing the number of steps. And the other is using a Repeat block.

 

Just change the step number there to 300 and see what happens? Now we want to add in an event block so that when you press the monkey it moves.

 

 

When you give 300 steps it goes forward. And when you give -300 afterwards it comes back to the original place.

 

So we learnt when you give positive value it moves towards right and negative value makes it move towards left.

 

Now once we have added the blocks we want the monkey to move to stay there for 1 second and come back to its original space.

This is the code:

See what happens?

Or add in a repeat block and repeat it 30 times. See what happens?

 

Now we will get the same result with the repeat block too.

It helps us minimize the code as we can repeat a same code block many times without writing it.

 

You can add more code to your loop, to do interesting things.

Add the change color effect by 25 block into the loop (from the Looks’ section).

Click the Sprite to see your new animation.

Add in next costume block inside the look and you will see monkey moving like it’s running. Notice the change?

You can also make your Monkey get bigger as it moves towards the Tree. Add in the block:

Change the code to:

Careful! It might get out of the screen and pinch you!  ^_^

 

 

Test out your animation. What happens if you click the monkey a second time? Does your Monkey start off the right size? Can you use this block to fix your animation?

Make your code like this to go back to its smaller size.

Save your project

Now add in some sound block to make the monkey make some noise!

Our new code looks like this:

Step 3: Strolling Lion

Activity Checklist

Start by adding in a Lioness sprite from the library.

 Save your project

Now program it to make it move behind the monkey.

Click the Lioness and on the ‘script tab’,

See if you can add a sound?

Now there is no sound for a Lion in the library, you can record your own sound. Click the microphone on the sounds tab. And record it using the circular button and give it a name. Something like lionsound.

Add in the sound from the Script tab. The code for Lioness should look like this:

And the script for the Monkey should look like this:

Save your project.

Now press ‘a’ and then ‘s’ on the keyboard and see what happens?

Challenge: Make your own animation

Stop your animation, and click ‘File’ and then ‘New’, to start a new project.
Use what you’ve learned in this project to make your own animation.

Save your project

Find out the PDF version here.