Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Help! I need to animate my sprites!
- RedDaniel2468
-
Scratcher
13 posts
Help! I need to animate my sprites!
I keep making games that I want to add animations to, but everytime I try to make a certain animation play, it gets interrupted by the idle animation. I use a state variable that gets modified whenever a certain action is performed. So far the running walking and idle were working, but for the jumping animation it gets interrupted. Is there a better way to execute this? Or do I just need a whole entirely new animating system?
- Dragon_Ball_Master10
-
Scratcher
1 post
Help! I need to animate my sprites!
Try deleting the idle animation then I guess.
- Spentine
-
Scratcher
1000+ posts
Help! I need to animate my sprites!
You may need a new animation system that allows for interrupts. You may have a current animation and current frame variable to keep track of the current animation and its frame. When playing another animation, it may set the current animation variable to a different value and the current frame value to 0. Every frame, the current frame value should increment by 1 and reset to 0 if it's larger than some number.
That's essentially how it would work.
That's essentially how it would work.
- RedDaniel2468
-
Scratcher
13 posts
Help! I need to animate my sprites!
Everything is going great so far, the issue is sorta resolved, but it still needs fixing. The animation only plays if you keep the key held down. I might have done some things wrong, so a video or just a project where I could check the code would be nice.
- MasterofTheBrick
-
Scratcher
1000+ posts
Help! I need to animate my sprites!
It would be easier for others to help if there was a reference link to the project. Otherwise simply ensure that your code has been created systematically - when the stipulated key’s pressed, run through X number of costumes, reverting back to the starting costume upon reaching the end of the appropriate animation loop.
- Discussion Forums
- » Help with Scripts
-
» Help! I need to animate my sprites!