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

#1 2009-04-06 12:30:46

Orocles
Scratcher
Registered: 2009-04-06
Posts: 6

Making sprites come on one side and off the other

I'm really stuck, because I want to have a sprite that can come off one side of the screen and come on the other. Can anyone help me????

Offline

 

#2 2009-04-06 15:46:09

cheddargirl
Scratch Team
Registered: 2008-09-15
Posts: 1000+

Re: Making sprites come on one side and off the other

I'm assuming you mean something like a toroidal donut.

Try this:
If touching edge
      If x position > 235
           set (x position) to -235
      else
          if x position < -235
              set x position to 235
      If (y position > 175)
          set y position to -175
      else
          if (y position < -175)
              set y position to 175

(NOTE: I haven't tried this yet).


http://i.imgur.com/8QRYx.png
Everything is better when you add a little cheddar, because when you have cheese your life is at ease  smile

Offline

 

#3 2009-04-06 15:50:37

Paddle2See
Scratch Team
Registered: 2007-10-27
Posts: 1000+

Re: Making sprites come on one side and off the other

cheddargirl wrote:

I'm assuming you mean something like a toroidal donut.

Try this:
If touching edge
      If x position > 235
           set (x position) to -235
      else
          if x position < -235
              set x position to 235
      If (y position > 175)
          set y position to -175
      else
          if (y position < -175)
              set y position to 175

(NOTE: I haven't tried this yet).

That should work fine...I do something similar in this project, if you want to see it in action

http://scratch.mit.edu/projects/Paddle2See/317725


http://i39.tinypic.com/2nav6o7.gif

Offline

 

#4 2009-04-07 12:32:10

Orocles
Scratcher
Registered: 2009-04-06
Posts: 6

Re: Making sprites come on one side and off the other

Okay! Thanks guys!

Offline

 

Board footer