Discuss Scratch

TGage23
New Scratcher
2 posts

How do I add gravity to my game (really good gravity)

I want it to work with only one sprite
Link2358
Scratcher
100+ posts

How do I add gravity to my game (really good gravity)

Most games just change a Y Velocity variable by -1 to create gravity*. But if you want realistic gravity you can find some documentation on the scratch wiki or you can copy the code I made**

when green flag clicked
forever
change [Y Velocity v] by (-1)
change y by (Y Velocty)
end



Good luck on your project!
TGage23
New Scratcher
2 posts

How do I add gravity to my game (really good gravity)

i will use simple code thanks if you do not mind can you help me come up with a game name : )
iX-Xi
Scratcher
100+ posts

How do I add gravity to my game (really good gravity)

also don't forget the:

when green flag clicked
forever
if <touching [ground v] ?> then
set [Y Velocity v] to ((Y Velocity) * (-0.5))
wait (0) secs
end
end

for actual floor detection

Powered by DjangoBB