Discuss Scratch

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!
MonzaM0nk3y123
Scratcher
43 posts

PLATFORMER GRAVITY

super_crazy wrote:

Check out griffpatch's tutorial here: https://scratch.mit.edu/projects/67727504/
It contains gravity, jumping, wall detection and much more!
thanks this helped a lot
DaEpikDude
Scratcher
1000+ posts

PLATFORMER GRAVITY

A basic gravity engine is as follows:
when gf clicked
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
Edit: Ninja'd by 10 seconds!

Last edited by DaEpikDude (Oct. 16, 2017 05:31:54)

GokulUser200
Scratcher
6 posts

PLATFORMER GRAVITY

say [thnaks!]
AstroRoblox
Scratcher
8 posts

PLATFORMER GRAVITY

when green flag clicked
say [thanks dude]
say [ok bye scratch post]
SuperFireLavaBoy
Scratcher
4 posts

PLATFORMER GRAVITY

how about gravity without variables.
1132262
Scratcher
1000+ posts

PLATFORMER GRAVITY

SuperFireLavaBoy wrote:

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.
finTaylor
New Scratcher
1 post

PLATFORMER GRAVITY

what is necropost
deck26
Scratcher
1000+ posts

PLATFORMER GRAVITY

finTaylor wrote:

what is necropost
Posting 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.
Agent_YT
Scratcher
1 post

PLATFORMER GRAVITY

say [Thank you!]
codeman1044
Scratcher
1000+ posts

PLATFORMER GRAVITY

Agent_YT wrote:

say [Thank you!]
Please don't blockspam or necropost.
B_LesinskiCS
Scratcher
1 post

PLATFORMER GRAVITY

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

bullybilldestroyer wrote:

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
Please check to see if there's already a solution before posting.
098765432154321
Scratcher
500+ posts

PLATFORMER GRAVITY

SuperFireLavaBoy wrote:

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.
Rx2_0
New Scratcher
1 post

PLATFORMER GRAVITY

say [Thank you]
move (cool) steps
crazymania91
Scratcher
5 posts

PLATFORMER GRAVITY

move (52) steps

Powered by DjangoBB