Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » How to get rid of bouncing
- Ierb_games
- Scratcher
18 posts
How to get rid of bouncing
Hello, so I am looking for help… My gravity script is causing my sprite to bounce.
Can anyone help?
Here is my script:
Can anyone help?
Here is my script:
define Check keys - left & right
Check collision
if <<(touching) > [0]>> then
set [YVEL] to [0]
set [i] to [0]
repeat until <<(touching) < [1]>>
change [i] by [.1]
change y by [.3]
Check collision
end
change [y] by [i]
stop [this script]
end
set [KEY JUMP] to (<key [w] pressed?> + ())
change [YVEL] by ((KEY JUMP) * [2]
change [YVEL] by [gravity]
change [y] by [YVEL]
define Check collision
set (touching) to <touching [Platform]>
Last edited by Ierb_games (Oct. 13, 2021 00:45:36)
- MasterofTheBrick
- Scratcher
1000+ posts
How to get rid of bouncing
The blocks which control the movement of the player to prevent it from going into the platform should be shifted into a c/block w/o screen refresh. In this case, the “repeat until” loop looks like it's causing the problem.
- Ierb_games
- Scratcher
18 posts
How to get rid of bouncing
Ok, thanks! The blocks which control the movement of the player to prevent it from going into the platform should be shifted into a c/block w/o screen refresh. In this case, the “repeat until” loop looks like it's causing the problem.
- Discussion Forums
- » Help with Scripts
- » How to get rid of bouncing