Discuss Scratch
- Discussion Forums
- » Requests
- » Adding Gravity To A Sprite
- brownotter46
-
Scratcher
10 posts
Adding Gravity To A Sprite
Adding Gravity To A Sprite
Hello! If you want to add gravity to any of your projects, then you've come to the right place!
Let's get started! So first, you obviously need a sprite. Then you create this script:
Also, if you are new to Scratch™, then no, that does not mean that you get a
can of soda if you view this.
Hello! If you want to add gravity to any of your projects, then you've come to the right place!
Let's get started! So first, you obviously need a sprite. Then you create this script:
when green flag clickedSo, now that that step is over, you can enjoy your sprite with gravity.
if <key [up arrow v] pressed?> then
set [velocity v] to [0]
set [y target v] to (y position)
repeat (5)
change y by (10)
end
change [velocity v] by (1)
change y by (join [-] (velocity))
repeat until <(round (y position)) = (round (y target))>
change [velocity v] by (1)
change y by (join [-] (velocity))
end
if <not <(round (y position)) = (round (y target))>> then
set y to (y target)
end
end
Also, if you are new to Scratch™, then no, that does not mean that you get a
can of soda if you view this.
- AFNNetworkK12
-
Scratcher
1000+ posts
Adding Gravity To A Sprite
i use scrach 3.0 i ges its not compatiblePlease don't necropost.:
- ROBOTDENVER
-
Scratcher
7 posts
Adding Gravity To A Sprite
what is necropost remember I said some thing on untitled- 98i use scrach 3.0 i ges its not compatiblePlease don't necropost.:
- Exsnailabur
-
Scratcher
38 posts
Adding Gravity To A Sprite
broadcast [ The lies begin][scratchblocks]
when green flag clicked
say [it don't work] for (2) secs
ask [Any other ideas] and wait
go to x: (away from liars) y: (away from liars)
[/scratchblocks]
when I receive [the lies begin]
forever
<[Me] = [Scream]>
end
Last edited by Exsnailabur (Feb. 20, 2020 23:35:19)
- Exsnailabur
-
Scratcher
38 posts
Adding Gravity To A Sprite
Adding Gravity To A Sprite
Hello! If you want to add gravity to any of your projects, then you've come to the right place!
Let's get started! So first, you obviously need a sprite. Then you create this script:when green flag clickedSo, now that that step is over, you can enjoy your sprite with gravity.
if <key [up arrow v] pressed?> then
set [velocity v] to [0]
set [y target v] to (y position)
repeat (5)
change y by (10)
end
change [velocity v] by (1)
change y by (join [-] (velocity))
repeat until <(round (y position)) = (round (y target))>
change [velocity v] by (1)
change y by (join [-] (velocity))
end
if <not <(round (y position)) = (round (y target))>> then
set y to (y target)
end
end
Also, if you are new to Scratch™, then no, that does not mean that you get a
can of soda if you view this.
turn cw (Away from this liar) degrees
This don't work, DO SOMETHING NEW!!!!!!!!!!!!!!!:mad::mad::mad::mad::mad::mad::mad::mad::mad::mad::mad::mad::mad::mad::mad::mad::mad::mad::mad::mad::mad::mad::mad:
say [I AM GOING CRAZY!!!!!!!!!!!!!!!]
- Exsnailabur
-
Scratcher
38 posts
Adding Gravity To A Sprite
You guys are overcomplicating it. Here is a sprite with a script that worked with 0 variables.
https://scratch.mit.edu/projects/376531541/
it is so simple.
https://scratch.mit.edu/projects/376531541/
it is so simple.
- LittleCoder06
-
Scratcher
54 posts
Adding Gravity To A Sprite
I can't find the round block
The round block is in the operators' category above the “abs of ()” block and after the “() mod ()” block
- catdog1474
-
Scratcher
11 posts
Adding Gravity To A Sprite
THANK you!
PS YOU NEED A SCRIPT WHERE IF YOU TOUCH THE GROUND YOU DON'T FALL THROUGH IT
PS YOU NEED A SCRIPT WHERE IF YOU TOUCH THE GROUND YOU DON'T FALL THROUGH IT- LittleCoder06
-
Scratcher
54 posts
Adding Gravity To A Sprite
This is the code i used:
the second code you need to put in your project:
you also need black ground as a backdrop
when green flag clicked
forever
if <key [up arrow v] pressed?> then
set [velocity v] to [4]
change y by (velocity)
repeat until <touching color [#000000] ?>
change [velocity v] by [-0.1]
change y by (velocity)
end
end
set [velocity v] to [0]
play sound [boing v]
end
the second code you need to put in your project:
when green flag clicked
set [velocity v] to [0]
forever
set rotation style [left-right v]
if <key [right arrow v] pressed?> then
point in direction (90 v)
move (5) steps
end
if <key [left arrow v] pressed?> then
point in direction (-90 v)
move (5) steps
end
you also need black ground as a backdrop
Last edited by LittleCoder06 (Nov. 3, 2020 11:05:22)
- LittleCoder06
-
Scratcher
54 posts
Adding Gravity To A Sprite
This is the code i used:also, you need to add a black ground as a backdropwhen green flag clicked
forever
if <key [up arrow v] pressed?> then
set [velocity v] to [4]
change y by (velocity)
repeat until <touching color [#000000] ?>
change [velocity v] by [-0.1]
change y by (velocity)
end
end
set [velocity v] to [0]
play sound [boing v]
end
the second code you need to put in your project:when green flag clicked
set [velocity v] to [0]
forever
set rotation style [left-right v]
if <key [right arrow v] pressed?> then
point in direction (90 v)
move (5) steps
end
if <key [left arrow v] pressed?> then
point in direction (-90 v)
move (5) steps
end
- FLORAIDER
-
Scratcher
5 posts
Adding Gravity To A Sprite
when green flag clicked
say [how u put gravity]
<[Me] = [searches how u put gravity]>
say [*gasps* i found it hehe boii]
define *clicks*
say [oke i know how :D]
Last edited by FLORAIDER (Nov. 14, 2020 12:52:01)
- Discussion Forums
- » Requests
-
» Adding Gravity To A Sprite

:

:

: