Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Zero gravity toggle whenever a sprite touches a different sprite
- Shrek_em
-
34 posts
Zero gravity toggle whenever a sprite touches a different sprite
Hello fellow scratchers!
I'm considering making a platformer but as soon as the character touches a piece of ground, it loses gravity and starts drifting with the force from the player applied to it to make it drift in a direction. Basically, I need a code that will make a sprite have zero gravity and drift in the direction that the player sprite landed. Any ideas?
_________________________________________________________________________________________________________________________
I'm considering making a platformer but as soon as the character touches a piece of ground, it loses gravity and starts drifting with the force from the player applied to it to make it drift in a direction. Basically, I need a code that will make a sprite have zero gravity and drift in the direction that the player sprite landed. Any ideas?
_________________________________________________________________________________________________________________________
-Shrek_em
Really bad coder :P
- 27xz
-
65 posts
Zero gravity toggle whenever a sprite touches a different sprite
You could have a variable which controls gravity which is inverted when the player touches the ground (from 5 to -5 or something), in addition to making the current gravity, which is something you should already track using platformer scripts, multiplied by -1 to invert it. If you don't know how to do platformer scripts, there are many tutorials out there, griffpatch and otherwise, and I would recommend looking at some of those to get something which works for you.
- Shrek_em
-
34 posts
Zero gravity toggle whenever a sprite touches a different sprite
sorry I should define that the platform the player You could have a variable which controls gravity which is inverted when the player touches the ground (from 5 to -5 or something), in addition to making the current gravity, which is something you should already track using platformer scripts, multiplied by -1 to invert it. If you don't know how to do platformer scripts, there are many tutorials out there, griffpatch and otherwise, and I would recommend looking at some of those to get something which works for you.touches loses gravity
- Discussion Forums
- » Help with Scripts
-
» Zero gravity toggle whenever a sprite touches a different sprite