My student wants his sprite to animate without any user input and then stop after one loop if animation. Any idea how this can work?
Thanks!
My student wants his sprite to animate without any user input and then stop after one loop if animation. Any idea how this can work?
Thanks!
Can you maybe share a link to the project? I’m not quite sure what you mean by “animate.” Is it an animated sprite (ie has more than one image embedded in it)?
Let us know.
thanks,
Mike
Here is the link!
The student wants the Slash and Pow sprites to only move once and then stop moving.
Hi @hcooper,
What a great game! I am going to make some assumptions. I am going to assume by animate you mean the frame animation of the sprite. So if we break down the problem, it would look like:
Hope these tips help. Let us know if you have any other questions.
Michelle
Thank you Michelle.
Working with the student, we are not quite sure how the timer needs to be set up. This is what the student has tried.
Yes. I see slashTimer was declared and set = 0. Nice job. Now he just needs to add a counter pattern in the draw loop and the bit of math to convert to seconds:
slashTimer = slashTimer+1/30
~Michelle
Thank you for your help!
If you don’t mind, we have a new question.
In the top left there is a health bar, there is already code in place to change the bar’s sprite as if health were being depleted (by a quarter of the bar each time) from previous experimentation with changing the health bars, all of them get activated because of their statement conditions, or none at all. Right now only going to 3/4 of the bar works. It should happen when the space bar is pressed, the function “doraHPTimer” contains the four functions for the top left health bar (for organization) doraHPTimer4(); is for full health, 3 for 3/4, etc., and even though it says it is a timer, it’s not counting down or up, it’s just a name.
This is such a great game. I love the graphics. It is such a big game and there are so many questions I have that without having the student to answer them, debugging is difficult. Here are some tools I use with students to help debug especially the more complex games.
Good luck!
It is a great game