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

#1 2007-05-17 01:43:59

Ginger_Overlord
Scratcher
Registered: 2007-05-17
Posts: 11

Ping-ponging

Hi,

Sorry, newb here...

Ive been trying to get my sprite to constantly move but stop and turn around when it hits an edge (so that it ping-pongs from edge to edge). How do I do this?  I've been trying to use the 'wait until' command but this doesn't seem to work.

Any help - greatly appriciated,

G_O.

Offline

 

#2 2007-05-17 05:21:52

Dthen
Scratcher
Registered: 2007-05-16
Posts: 26

Re: Ping-ponging

hmmm, just experimented there, got it.


When green flag clicked
forever
-move 10 steps
-if touching edge
--turn 90 degrees


put the move the if touching edge inside the forever block, and the turn 90 inside the if.  smile

Offline

 

#3 2007-05-17 15:25:27

Duncan
Scratcher
Registered: 2007-05-15
Posts: 47

Re: Ping-ponging

Or you could use the...

If on edge, bounce

...Motion instruction if you are just ping-ponging across the stage.  Check the Sprites rotation options next to the Sprites image at the top or it could bounce upside down.

Offline

 

#4 2007-05-17 17:11:01

Ginger_Overlord
Scratcher
Registered: 2007-05-17
Posts: 11

Re: Ping-ponging

Hi,

Excellent! that's just what I needed.

This is a great little program and I'm just experimenting with it at the moment. I'm hoping to produce an animation or two and maybe (MAYBE) a game sometime in the near future.

Many thanx for the advice - happy scratching!

G_O.

Offline

 

#5 2007-05-17 17:35:45

Dthen
Scratcher
Registered: 2007-05-16
Posts: 26

Re: Ping-ponging

I think if you use if on edge bounce, with the default cat, that's exactly what happens, which is why i did it the long way.

Offline

 

Board footer