Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Help understanding on how idle animations work
- 1234goofyhere
-
Scratcher
53 posts
Help understanding on how idle animations work
I am doing a project called dustfell last genocide but i do not know how the idle animations work i just borrow them from other projects but wanna make my own now if someone can explain how they work i would appreciate it
Last edited by 1234goofyhere (Jan. 23, 2024 13:41:17)
- MrDanglyLegs
-
Scratcher
100+ posts
Help understanding on how idle animations work
Basically, if the character is not moving, the animation will run.
Just number the frames of the animation “idle0” “idle1” “idle2”, etc. Hope this helps!
when gf clicked
set [tmp v] to (1)
forever
if <not <moving>> then
switch costume to (join (idle) ((tmp) mod [# of frames in the animation])
change [tmp v] by (1)
end
Just number the frames of the animation “idle0” “idle1” “idle2”, etc. Hope this helps!
- 1234goofyhere
-
Scratcher
53 posts
Help understanding on how idle animations work
Basically, if the character is not moving, the animation will run.just one problem i got to be able to change the head and body plus legswhen gf clicked
set [tmp v] to (1)
forever
if <not <moving>> then
switch costume to (join (idle) ((tmp) mod [# of frames in the animation])
change [tmp v] by (1)
end
Just number the frames of the animation “idle0” “idle1” “idle2”, etc. Hope this helps!
- ItBeJC
-
Scratcher
1000+ posts
Help understanding on how idle animations work
Basically, if the character is not moving, the animation will run.I think their body parts are separate sprites or clones. This would complicate things a bit more, but I don't think it would change too much. If I were doing it, I'd probably do it like this:when gf clicked
set [tmp v] to (1)
forever
if <not <moving>> then
switch costume to (join (idle) ((tmp) mod [# of frames in the animation])
change [tmp v] by (1)
end
Just number the frames of the animation “idle0” “idle1” “idle2”, etc. Hope this helps!
Make a list for each body part. In this list, you will save the information for each frame in the idle animation (like the x, y, direction, etc.). Then when you run the idle animation, just use a tick variable to go through the list. I'll make an example in code below. I'll use the right arm:
Keep in mind that in this example each frame will have an x, y, and direction. This means there are 3 list items per frame which is why I change the index variable by 3 and I only repeat for the length of the list divided by 3.
when green flag clickedKeep in mind that the second repeat loop reverses the animation. I put this because I'm thinking that you want your animation to look like breathing, where the character slowly goes up and down. This would create that affect. However, if you do not want your idle animation to be reversed, just remove the second repeat loop.
forever
if <not <Moving>> then
Idle Animation (Right Arm) :: Custom // I recommend putting the script that runs the animation in a custom block to simplify it
end
end
define Idle Animation (Right Arm)
set [index v] to [0]
repeat ((length of [Right Arm Idle Animation v] :: list) / (3))
change [index v] by (3)
go to x: (item ((index) - (2)) of [Right Arm Idle Animation v] :: list) y: (item ((index) - (1)) of [Right Arm Idle Animation v] :: list)
point in direction (item (index) of [Right Arm Idle Animation v] :: list)
wait (0) secs // To stop the animation from running too fast
end
repeat (((length of [Right Arm Idle Animation v] :: list) / (3)) - (1)) // Reverses the idle animation
change [index v] by (-3)
go to x: (item ((index) - (2)) of [Right Arm Idle Animation v] :: list) y: (item ((index) - (1)) of [Right Arm Idle Animation v] :: list)
point in direction (item (index) of [Right Arm Idle Animation v] :: list)
wait (0) secs // To stop the animation from running too fast
end
Last edited by ItBeJC (Jan. 23, 2024 17:59:10)
- JustinNina1
-
Scratcher
1 post
Help understanding on how idle animations work
CAN IT BE A BIT MORE SIMPLE???



- RedifiedL
-
Scratcher
8 posts
Help understanding on how idle animations work
Basically, if the character is not moving, the animation will run.when gf clicked
set [tmp v] to (1)
forever
if <not <moving> then
switch costume to (join (idle) ((tmp) mod [# of frames in the animation])
change [tmp v] by (1)
end
Just number the frames of the animation “idle0” “idle1” “idle2”, etc. Hope this helps!
- Reduxian121755
-
Scratcher
5 posts
Help understanding on how idle animations work
Hi
Last edited by Reduxian121755 (Sept. 24, 2025 15:32:09)
- Discussion Forums
- » Help with Scripts
-
» Help understanding on how idle animations work





