Discuss Scratch

christophermc0324
Scratcher
19 posts

How do you make your sprite go up and down?

Hi! Its me again, and I was wondering, how do you make a sprite go up and down? I don't mean put on gravity, though. The tutorial videos only showed how to go left and right.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
My Favorite Code:
when green flag clicked
play sound [ v]
EbuVitae
Scratcher
47 posts

How do you make your sprite go up and down?

Um, in Motion:
set y to (0)
This sets your Y-Position, or height, on the screen.
set y to (180)
This sets your sprite to the top of the screen.
set y to (-180)
This sets your sprite to the bottom of the screen.


Now, we also have this block:
change y by (10)
This moves your sprite a number of pixels up.
Use negative to make the sprite go down.


This is my favorite script for moving a sprite up and down.
when green flag clicked
forever

if <key [up arrow v] pressed?> then
change y by (5)
end
if <key [down arrow v] pressed?> then
change y by (-5)
end

Hope this helps.
sunrise4b
New Scratcher
1 post

How do you make your sprite go up and down?

thank u
sharon8080
New Scratcher
3 posts

How do you make your sprite go up and down?

Thanks so much @EbuVitae
sharon8080
New Scratcher
3 posts

How do you make your sprite go up and down?

when [down arrow v] key pressed
change y by (-5)
when [up arrow v] key pressed
change y by (5)

here is another way to do it based on @EduVitae's idea.
hope it works!

Last edited by sharon8080 (May 12, 2015 02:13:50)

19waltersa
Scratcher
100+ posts

How do you make your sprite go up and down?

Yep that's the way I do it when I need it.
PuppyWuppy10
Scratcher
100+ posts

How do you make your sprite go up and down?

Heya! Well there are some ways! But I will show you the easer way!


Here is this one! ^.^ If you put -5 in the insert section it should make it go down. Sorry if I'm wrong.
change y by (-5)

Then this way SHOULD make it go up. Again sorry if I'm wrong
change y by (5)

Well hope that helped!

Powered by DjangoBB