Zero gravity toggle whenever a sprite touches a different sprite

id: 750201

category: Help with Scripts

posts: 4

Shrek_em Shrek_em loading
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?
_________________________________________________________________________________________________________________________
-Shrek_em
Really bad coder :P

27xz 27xz loading
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.
Wolf_Link21 Wolf_Link21 loading
forever
if <not <touching [ no gravity sprit v] ?>> then

set [gravity v] to [0]
else
set [gravity v] to [5]
end
movement
end
Shrek_em Shrek_em loading

27xz wrote:

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.
sorry I should define that the platform the player touches loses gravity