Zero gravity toggle whenever a sprite touches a different sprite
id: 750201
category: Help with Scripts
posts: 4
Mar 25, 2024 19:44:16
Zero gravity toggle whenever a sprite touches a different sprite
view on scratch
view on legacy ocular
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?
_________________________________________________________________________________________________________________________
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
Mar 25, 2024 21:02:19
Zero gravity toggle whenever a sprite touches a different sprite
view on scratch
view on legacy ocular
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.
Mar 25, 2024 21:04:54
Zero gravity toggle whenever a sprite touches a different sprite
view on scratch
view on legacy ocular
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
Mar 26, 2024 13:36:17
Zero gravity toggle whenever a sprite touches a different sprite
view on scratch
view on legacy ocular
Shrek_em
loading
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