Flash/animate a sprite through frames


#1

After three lives are used, the students wants the YOU LOSE sprite (bb) to show up.
He has created frames in the ANIMATION tab to make the sprite move like a .gif. When in the ANIMATION section, the sprite does flash through all the frames, but in the game, it goes to the first frame and stops, no flashing.
How does one get the frames of a sprite to flash through on the game.


#4

Lena,

In all honesty I don’t know if GameLab supports .gifs. I know I’ve seen them in samples, but I don’t know if the one that students use support this. I’ll bump this question up to see if we can get answer from a developer.

Brad


#6

It’s not a true .gif. He created it with layers In the animation section. It runs through the “layers,” when in the animation section, but in the game it does not.


#7

@lkeil
Hi Lena,

(I was on winter break but am now back.)

The problem is that he is creating a new sprite and setting its animation every time that function is called. So, in each iteration of the draw look, there is a new sprite that is starting again with the first frame of the animation.

For the most part, sprites should be created outside of the draw loop and only modified inside the draw loop. In this case, the sprite should be created outside the draw loop (at the end of the list of new sprites so it’s on top), and its visibility should be set to false. Then, when the user loses, the visibility should be set to true. This should fix the problem.

Elizabeth


#8

Thank you so much! I will pass this information along to the student.