Gravity and Jumps in Scratch
id: 750748
category: Help with Scripts
posts: 8
Unknown05212
loading
Hii! I am a new scratcher(not that new, but still). I've been trying to use gravity and jumps in my projects recently. Anyone know how to make my sprite stop falling after landing on an object and also stop pausing midair?
MineTurte
loading
Hii! I am a new scratcher(not that new, but still). I've been trying to use gravity and jumps in my projects recently. Anyone know how to make my sprite stop falling after landing on an object and also stop pausing midair?
when green flag clicked
forever
if <touching [ floor] ?> then
if <not <key [ space] pressed?>> then
set [ velocity] to [0]
else
repeat (10)
change [ velocity] by (1)
end
end
else
change [ velocity] by (-1)
end
end
when green flag clicked
forever
change y by (velocity)
end
Hope this helps!
Note: It might be a little buggy but it should work good enough. Feel free to refine the jumping part of it as that is the buggiest.
52-94_Penguins
loading
You shoudl prbaly just look it up, but i would recomend something like this
and forever change YV by like -0.1
Same wroks for XV
YV=Y velocicyty
XV=X Veoeltiy
change y by (YV)
if <touching [Floor] ?> then
change y by ((0) - (YV)
set [YV] to ((0) - (YV))
end
and forever change YV by like -0.1
Same wroks for XV
YV=Y velocicyty
XV=X Veoeltiy
Unknown05212
loading
Thanks!
Unknown05212
loading
……Hope this helps!……This is JuniperActias. AKA Moth mommy. If I helped you out consider following Juni-Bug (my new account)!Thanks! Sure I will
invalidaccess
loading
i recommend you to watch griffpatch's platformer tutorials
Norse7
loading
or you could try something like this to prevent the sprite from looking like it's gliding up:
define ResolveCollision this is run without screen refresh
repeat until <not <touching [ground v] ?>>
change y by (1)
end
fireplaceman
loading
Hi, I need help figuring out how to make gravity compatible for this jumping script:
when green flag clicked
set [jump height v] to [13]
forever
if <key [up arrow v] pressed?> then
set [jump velocity v] to (jump height)
repeat until <(jump velocity) = [0]>
change y by (jump velocity)
change [jump velocity v] by (-1)
end
repeat until <(jump velocity) = (join [-] (jump height))>
change [jump velocity v] by (-1)
change y by (jump velocity)
end