2D Sprite Animation with SceneMax

3D Animation Language for Kids

2D Sprite Animation with SceneMax

Sprite Animation

Sprite animation is easy and fun with SceneMax. All we need is a image divided to small frames such as this one:

Here we have one image divided to 5 rows and 6 columns giving us a total of 30 frames. We call that kind of image a Sprite Sheet.

In SceneMax, write the following program:

RunningMan is a sprite ;
David is a RunningMan ;

Let’s run the program

The entire image with all its frames is shown on the screen.
Now let’s refine our program and divide the image to 5 rows and 6 columns:

RunningMan is a sprite having rows=5 and cols=6;
David is a RunningMan ;

Now, let’s run the program

Great! the image is now divided into 30 frames and we see only one small frame every time. By default the first frame (frame number 0) is shown.

Now let’s add some animation to the RunningMan sprite:
.
RunningMan is a sprite having rows=5 and cols=6;
David is a RunningMan ;
David.play(frames 0 to 29 in 2 seconds) ;

Run the program and see how the sprite is playing its frames from 0 to 29 in 2 seconds giving us the illusion of a running man.
By default the frames are played just once. We can change the playing strategy for one of the following options:

Loop – play the frames any number of times for example:
David.play(frames 0 to 29 in 2 seconds)  loop 3 times ;

If we just type Loop, then it will play the frames forever for example:
David.play(frames 0 to 29 in 2 seconds)  loop ;

Time duration – play the frames for a given amount of time for example:
David.play(frames 0 to 29 in 2 seconds)  for 10 seconds ;

Moving the sprite

We can move our sprite on any of the 3 axes – X, Y or Z for example:
David.move(z+5) in 2 seconds ;

this will move the sprite on along the Z axis

Leave a Reply

Your email address will not be published. Required fields are marked *