This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2012-10-02 15:02:00

osmith6
New Scratcher
Registered: 2012-10-02
Posts: 1

how to make sprites move across the screen

how do i make sprites move across the screen by entering and exiting? also, how do i make sprites enter the screen at a different location on the same side every time

Offline

 

#2 2012-10-02 15:43:46

Prestige
Scratcher
Registered: 2008-12-15
Posts: 100+

Re: how to make sprites move across the screen

So you can change the speed also, make a variable, (speed). Using the equation, speed = distance / time (where distance is 480 pixels [the width of the stage]), we can change the speed of the sprite.

forever
set x to (-240)
set y to (pick random (-180) to (180))
glide ((480) / (speed)) secs to x: (240) y: (y position)
Try changing the speed variable and see what effect it has and adjust it how you want. Setting x to (-240) will reset the sprite to the far left of the screen every time it reaches the right side. Picking a random Y value will mean that it appears at a different location on the same side of the screen every time as required.

If you have any related questions, ask away on this thread!

-Prestige  smile


"Don't insult someone until you've walked a mile in their shoes. That way, if they don't like what you have to say, you'll be a mile away and still have their shoes  smile  "

Offline

 

#3 2012-10-08 15:26:22

bgwilson
New Scratcher
Registered: 2012-10-08
Posts: 1

Re: how to make sprites move across the screen

How do I make a sprite glide across the screen? And how do I make a sprite appear on the screen and disappear?

Offline

 

#4 2012-10-08 17:10:41

Prestige
Scratcher
Registered: 2008-12-15
Posts: 100+

Re: how to make sprites move across the screen

show
This will show a sprite on the stage.
hide
This will hide a sprite on the stage.

You can use the 'glide' block as seen in my earlier reply so the sprite will glide across the screen. Just remember that the stage is 480x360 pixels wide, so if you want a sprite to move from left to right they'll go from x=-240 to x=+240:
set x to [-240]
glide (2) secs to x: (240) y: (any value)
Hope this helps you  smile


"Don't insult someone until you've walked a mile in their shoes. That way, if they don't like what you have to say, you'll be a mile away and still have their shoes  smile  "

Offline

 

Board footer