Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » How do i make my sprite do different animations (running, jumping, ducking, dying)?
- metafornick
-
New Scratcher
5 posts
How do i make my sprite do different animations (running, jumping, ducking, dying)?
I used some stickman sprites that i borrowed for someone, sadly I'm not on the computer that i bookmarked where i got that sprite, but anyways i put it in my game. I used the sprite1, which was for walking. I made a running and jumping game but i didn't use the jumping sprite then, only walking. when it jumped there was no animation. I used the next costume block, just like you would normally use in an animation. It worked perfectly. Everything was working, the stickman could move left, right, and could jump. Now i just had to make the stickman duck and die using the sprites i borrowed. What i didn't realize was that the 5th sprite (last sprite) was a sprite that included every single animation. So i deleted my sprite1 and started working on that sprite5. That was when i got into this issue. How will i make the sprite do the different animations? (once again, running, jumping, ducking and dying.) I can't use the next costume block, because when it moves left or right, it will not only run, but it will do every single other animation. I don't want it to do that obviously. I think you should already understand what I'm trying to say, and i also hope you understood, because i don't really know how to explain my problem. If you read this far, thank you. and please help me if you can, for me it doesnt really matter how fast this gets answered. and i couldnt find a tutorial, so yeah. another thing I would like to mention is that it might move perfectly fine when you see the game, but not to me. I'm one of those people who want to animate EVERYTHING, so i want to make it look more better and cleaner.
Link to project: Your text to link here…
Link to project: Your text to link here…
Last edited by metafornick (Feb. 7, 2024 20:53:45)
- kemoCyan
-
Scratcher
25 posts
How do i make my sprite do different animations (running, jumping, ducking, dying)?
define animation: start costume(start-costume.number) end costume(end-costume.number)
switch costume to [start-costume.number]
repeat until <(costume #) = [end-costume.number]>
next costume
wait (0.1) secs
end
so to use this you have to go to the costumes tabs and check every animation's start costume and end costume, for example:
the running animation starts at costume number 1 and ends at costume number 5; then you should put the number 1 in the first input and the number 5 in the second input. this will do the running animation
- bombardingppl
-
Scratcher
500+ posts
How do i make my sprite do different animations (running, jumping, ducking, dying)?
you should make the sprite only run in the burden of an animation at once maybe by doing this
if <(animation) = [2]> then //change this conditional to any other conditional which begins your animation
switch costume to [costume3] //change this to the first costume of that animation
repeat (3) //change this with the number of frames in one animation
next costume
wait (0.1) secs //or any other cooldown
end
end
//you can have more animations, just repeat this process
- metafornick
-
New Scratcher
5 posts
How do i make my sprite do different animations (running, jumping, ducking, dying)?
I used some stickman sprites that i borrowed for someone, sadly I'm not on the computer that i bookmarked where i got that sprite, but anyways i put it in my game. I used the sprite1, which was for walking. I made a running and jumping game but i didn't use the jumping sprite then, only walking. when it jumped there was no animation. I used the next costume block, just like you would normally use in an animation. It worked perfectly. Everything was working, the stickman could move left, right, and could jump. Now i just had to make the stickman duck and die using the sprites i borrowed. What i didn't realize was that the 5th sprite (last sprite) was a sprite that included every single animation. So i deleted my sprite1 and started working on that sprite5. That was when i got into this issue. How will i make the sprite do the different animations? (once again, running, jumping, ducking and dying.) I can't use the next costume block, because when it moves left or right, it will not only run, but it will do every single other animation. I don't want it to do that obviously. I think you should already understand what I'm trying to say, and i also hope you understood, because i don't really know how to explain my problem. If you read this far, thank you. and please help me if you can, for me it doesnt really matter how fast this gets answered. and i couldnt find a tutorial, so yeah. another thing I would like to mention is that it might move perfectly fine when you see the game, but not to me. I'm one of those people who want to animate EVERYTHING, so i want to make it look more better and cleaner.Here's my terrible studio project lol: https://scratch.mit.edu/projects/962939701/
Link to project: Your text to link here…
- metafornick
-
New Scratcher
5 posts
How do i make my sprite do different animations (running, jumping, ducking, dying)?
sorry, wrote the post above me by accident
- metafornick
-
New Scratcher
5 posts
How do i make my sprite do different animations (running, jumping, ducking, dying)?
also i really appreciate the help guys, i don't know how to thank you but i gave a b follow for all of you
i didn't know what to do so i just tried using what seemed less complicated to me
i didn't know what to do so i just tried using what seemed less complicated to me
Last edited by metafornick (Feb. 7, 2024 23:26:58)
- LP372
-
Scratcher
1000+ posts
How do i make my sprite do different animations (running, jumping, ducking, dying)?
I used some stickman sprites that i borrowed for someone, sadly I'm not on the computer that i bookmarked where i got that sprite, but anyways i put it in my game. I used the sprite1, which was for walking. I made a running and jumping game but i didn't use the jumping sprite then, only walking. when it jumped there was no animation. I used the next costume block, just like you would normally use in an animation. It worked perfectly. Everything was working, the stickman could move left, right, and could jump. Now i just had to make the stickman duck and die using the sprites i borrowed. What i didn't realize was that the 5th sprite (last sprite) was a sprite that included every single animation. So i deleted my sprite1 and started working on that sprite5. That was when i got into this issue. How will i make the sprite do the different animations? (once again, running, jumping, ducking and dying.) I can't use the next costume block, because when it moves left or right, it will not only run, but it will do every single other animation. I don't want it to do that obviously. I think you should already understand what I'm trying to say, and i also hope you understood, because i don't really know how to explain my problem. If you read this far, thank you. and please help me if you can, for me it doesnt really matter how fast this gets answered. and i couldnt find a tutorial, so yeah. another thing I would like to mention is that it might move perfectly fine when you see the game, but not to me. I'm one of those people who want to animate EVERYTHING, so i want to make it look more better and cleaner.idrk, use variables to track what the player is doing using if blocks
Link to project: Your text to link here…
- 10SmartGaming
-
Scratcher
86 posts
How do i make my sprite do different animations (running, jumping, ducking, dying)?
Store the players state in a variable. If he jumps, set it to “jump”, if he is running, set it to run, etc.
Have a frame clock like this:
Set the costume to the frame concatenated to the clock.
Let me know if you have any questions.
Have a frame clock like this:
((days since 2000) mod (however many frames there are))Have the costume names of your animations correlate with the names of your states. Like jump1 for jump frame 1, or run3 for frame 3 of the running animation.
Set the costume to the frame concatenated to the clock.
when I receive [updateAnimation v]If there are skins for the stickman, thats ok, just make a “skin” variable. Then add that to the costume names and concatenate it too.
switch costume to (join (playerState) ((days since 2000) mod (however many frames there are)))
Let me know if you have any questions.
- 10SmartGaming
-
Scratcher
86 posts
How do i make my sprite do different animations (running, jumping, ducking, dying)?
Correction: You should use the floor operator
([floor v] of ((days since 2000) mod (frame numbers)))
- 10SmartGaming
-
Scratcher
86 posts
How do i make my sprite do different animations (running, jumping, ducking, dying)?
nuh uhCorrection: You should use the floor operatorDid you know you can edit posts after you've created them?([floor v] of ((days since 2000) mod (frame numbers)))
- metafornick
-
New Scratcher
5 posts
How do i make my sprite do different animations (running, jumping, ducking, dying)?
hi guys! I know this post is 2 months old, and you probably won't see this, but i'm taking the project down and replacing it with a simulator. Currently this game is in a state not ready for public use, but i'll let you know when it's finished
- Holodilnik35
-
Scratcher
100+ posts
How do i make my sprite do different animations (running, jumping, ducking, dying)?
maybe this
when green flag clicked
switch costume to [first costume v]
repeat until <(costume #) = [number of last costume]>
next costume
end
- Discussion Forums
- » Help with Scripts
-
» How do i make my sprite do different animations (running, jumping, ducking, dying)?





