Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Zero gravity toggle whenever a sprite touches a different sprite
- Shrek_em
- Scratcher
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
Shrek_em
Really bad coder
Really good ideas
Want to make a signature?
Click this purple thing to figure out how
- 27xz
- Scratcher
57 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.
Potatoes are good. Game dev is good. Potatoes in game dev is remarkable.
- Wolf_Link21
- Scratcher
100+ posts
Zero gravity toggle whenever a sprite touches a different sprite
forever
if <not <touching [ no gravity sprit v] ?>> then
set [gravity v] to [0]
else
set [gravity v] to [5]
end
movement
end
This is dave
:D :: hat :: motionHe protects my from evil kumquats.
Please follow me if you find my response helpful and give me any ideas for my game https://scratch.mit.edu/projects/992371983/
- Shrek_em
- Scratcher
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
Shrek_em
Really bad coder
Really good ideas
Want to make a signature?
Click this purple thing to figure out how
- Discussion Forums
- » Help with Scripts
- » Zero gravity toggle whenever a sprite touches a different sprite