Adding Multiple Frames in Unit 3

How do you add multiple frames to give the illusion of a sprite walking?

You would use the Draw Loop. Unit 3, Lesson 11 is where the Draw Loop is introduced for animation. Here is the video that gives a basic explanation of how it works. Code.org

If you draw the same background at the beginning of the loop each time and then change the x or y coordinate of the sprite it will appear to move.

Walking is different. You would need to have multiple shapes/sprites that make up the figure and use the rotate, x and y coordinates to move the shapes and give the illusion of it walking. It can be time consuming to get all the coordinates and rotations just right.

I am guessing you’re meaning “how to make your sprites look like they’re walking”.
If you’re asking this, then I will tell you that it’s a hard process if you aren’t an artist. You will have to do a lot of copy and pastes to move the legs like if they’re actually walking. Oh and that’s if your characters are pixelated, if they aren’t, you will have to redraw the legs every frame. It isn’t worth wasting your time on this, if you really really want to add walking characters into your project then you should hire an artist, but that will cost money.

Hi @thompam1 ,

Just to add another perspective to the ones presented so far: you can add multi-frame animations to sprites in Game Lab. Here’s a help and tip resource showing some of the process: https://studio.code.org/docs/concepts/game-lab/animation-tab/multi-frame-animations/.

These are presented in Unit 3 of CS Discoveries, but not until the 2nd chapter and some of the later lessons. Once you and students end up in those lessons, multi-frame animations and “walking sprites” will be the norm.

Hope that helps!
Dan - Code.org Curriculum Writer

2 Likes