Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » is there gravity and how to make it?
- ILoveShapes00
-
New Scratcher
1 post
is there gravity and how to make it?
watch warfame's video in youtube
you will get it!
you will get it!
- mcgoomba
-
Scratcher
1000+ posts
is there gravity and how to make it?
when green flag clicked
forever
change [Y-velocity v] by (-1)
change y by (Y-velocity)
handle ground
end
define handle ground [RUN WITHOUT SCREEN REFRESH]
repeat until <not <touching color [ANY COLOR]>>
set [Y-velocity v] to [0]
change y by (1)
end
- helloworldbyeworld
-
Scratcher
1000+ posts
is there gravity and how to make it?
So that repeat until block will run until it’s touching no colors? That’s not possible so it will keep going and the player will stick to the top of the screen. Instead of any color (you can’t even code that), use not touching ground or whichever sprite that has the platforms.when green flag clicked
forever
change [Y-velocity v] by (-1)
change y by (Y-velocity)
handle ground
enddefine handle ground [RUN WITHOUT SCREEN REFRESH]
repeat until <not <touching color [ANY COLOR]>>
set [Y-velocity v] to [0]
change y by (1)
end
- greendayfan7
-
Scratcher
78 posts
is there gravity and how to make it?
I finally figured it out here's the script https://scratch.mit.edu/projects/651415754/ I made a project for you about gravity
- mcgoomba
-
Scratcher
1000+ posts
is there gravity and how to make it?
until the player dosn't touch the color you don't want it to touchSo that repeat until block will run until it’s touching no colors? That’s not possible so it will keep going and the player will stick to the top of the screen. Instead of any color (you can’t even code that), use not touching ground or whichever sprite that has the platforms.when green flag clicked
forever
change [Y-velocity v] by (-1)
change y by (Y-velocity)
handle ground
enddefine handle ground [RUN WITHOUT SCREEN REFRESH]
repeat until <not <touching color [#0f0]>>
set [Y-velocity v] to [0]
change y by (1)
end
- Discussion Forums
- » Help with Scripts
-
» is there gravity and how to make it?