Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » PLATFORMER GRAVITY
- MonzaM0nk3y123
-
Scratcher
43 posts
PLATFORMER GRAVITY
so I decided to make a platformer game, but I don't know how to make gravity effects. Nor jumping. If anybody can help this little noob it would be greatly appreciated!!!
- super_crazy
-
Scratcher
100+ posts
PLATFORMER GRAVITY
Check out griffpatch's tutorial here: https://scratch.mit.edu/projects/67727504/
It contains gravity, jumping, wall detection and much more!
It contains gravity, jumping, wall detection and much more!
- MonzaM0nk3y123
-
Scratcher
43 posts
PLATFORMER GRAVITY
Check out griffpatch's tutorial here: https://scratch.mit.edu/projects/67727504/thanks this helped a lot
It contains gravity, jumping, wall detection and much more!
- DaEpikDude
-
Scratcher
1000+ posts
PLATFORMER GRAVITY
A basic gravity engine is as follows:
when gf clickedEdit: Ninja'd by 10 seconds!
set [gravity v] to [0]//reset gravity at start
forever
change y by (gravity)//move with gravity
change [gravity v] by (-1)//gravity pulls you down so increase downwards velocity
if <touching [ground v]?> then
set [gravity v] to [0]//obviously no gravity since you're on the floor
if <key [up arrow v] pressed?> then
set [gravity v] to [10] //jump!
end
end
end
Last edited by DaEpikDude (Oct. 16, 2017 05:31:54)
- AstroRoblox
-
Scratcher
8 posts
PLATFORMER GRAVITY
when green flag clicked
say [thanks dude]
say [ok bye scratch post]
- 1132262
-
Scratcher
1000+ posts
PLATFORMER GRAVITY
how about gravity without variables.I don't see why you'd want to do that, but its possible. But it's like the least efficient podsible way to do gravity. Anyways, don't necropost.
- deck26
-
Scratcher
1000+ posts
PLATFORMER GRAVITY
what is necropostPosting in an old topic especially when not adding anything useful. All it means is the topic shoots back to the top of the forum for no purpose.
- codeman1044
-
Scratcher
1000+ posts
PLATFORMER GRAVITY
Please don't blockspam or necropost.say [Thank you!]
- bullybilldestroyer
-
Scratcher
4 posts
PLATFORMER GRAVITY
when green flag clicked
repeat until <touching color black>
change y by (-5)
end
when green flag clicked
forever
if <touching color black> then
forever
change y by (5)
set y to (-156)
end
end
end
Last edited by bullybilldestroyer (Oct. 8, 2019 20:44:50)
- codeman1044
-
Scratcher
1000+ posts
PLATFORMER GRAVITY
Please check to see if there's already a solution before posting.when green flag clicked
repeat until <touching color black>
change y by (-5)
endwhen green flag clicked
forever
if <touching color black> then
forever
change y by (5)
set y to (-156)
end
end
end
- 098765432154321
-
Scratcher
500+ posts
PLATFORMER GRAVITY
how about gravity without variables.It is possible to make a script that has no variables whatsoever and uses lists instead.
when green flag clicked
delete (all v) of [Gravity v]
add [0] to [Gravity v]
forever
change y by (Gravity :: list)
delete (all v) of [Gravity v]
add ((Gravity :: list) - (1)) to [Gravity v]
if <touching [ground v] ?> then
delete (all v) of [Gravity v]
add [0] to [Gravity v]
if <key [up arrow v] pressed?> then
delete (all v) of [Gravity v]
add [10] to [Gravity v
end
end
end
- cs2240541
-
Scratcher
19 posts
PLATFORMER GRAVITY
when green flag clicked
broadcast [Broadcast]
when I receive [Broadcast]
broadcast [Broadcast]
Ah yes, lag.
- Discussion Forums
- » Help with Scripts
-
» PLATFORMER GRAVITY


















