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

#1 2010-09-17 14:21:24

pacmanpickle
New Scratcher
Registered: 2010-09-12
Posts: 1

4d asteroids

u no in that asteroids game if the ship goes of the screen it appears the other side im having trouble doing it on a similar game on scratch
someone help plz

Offline

 

#2 2010-09-17 16:33:02

ScratchGirl100
New Scratcher
Registered: 2010-08-17
Posts: 25

Re: 4d asteroids

When green flag clicked
forever:
If touching edge and x > 0
Go to (Insert the far right side here)
If touching edge and x < 0
Go to (Insert the far left side here)
:end forever

And when you do the far right or left side, make sure the x is closer to zero by about fifteen, or you'll just blink back and forth.  smile


http://i55.tinypic.com/s4c9z9.gif

Offline

 

#3 2010-09-17 19:18:23

ScratchGirl100
New Scratcher
Registered: 2010-08-17
Posts: 25

Re: 4d asteroids

Here is an image;
http://i54.tinypic.com/hsmbn6.png

Sorry, I can't put in image tags, or URL tags.

Just copy and paste in your address bar.


http://i55.tinypic.com/s4c9z9.gif

Offline

 

#4 2010-09-17 19:58:07

TuffGhost
Scratcher
Registered: 2010-09-06
Posts: 500+

Re: 4d asteroids

Well that only works for the x-axis, and if the player touches the top or bottom, they'd be sent there too  hmm

I'd advise:

forever
   if < (x position) > (480) >
      set x to (-480)
   end if
   if < (x position) < (-480) >
      set x to (480)
   end if
   if < (y position) > (360) >
      set y to (-360)
   end if
   if < (y position) < (-360) >
      set y to (360)
   end if
end forever

That would work for all sides and I'm pretty sure it won't switch back and forth all that much.


http://i56.tinypic.com/vr8xvs.jpg

Offline

 

#5 2010-09-17 20:09:00

ScratchReallyROCKS
Scratcher
Registered: 2009-04-22
Posts: 1000+

Re: 4d asteroids

TuffGhost wrote:

Well that only works for the x-axis, and if the player touches the top or bottom, they'd be sent there too  hmm

I'd advise:

forever
   if < (x position) > (480) >
      set x to (-480)
   end if
   if < (x position) < (-480) >
      set x to (480)
   end if
   if < (y position) > (360) >
      set y to (-360)
   end if
   if < (y position) < (-360) >
      set y to (360)
   end if
end forever

That would work for all sides and I'm pretty sure it won't switch back and forth all that much.

Almost, but you got the screen measurements wrong. Here's what it should look like:

forever
   if < (x position) > (240) >
      set x to (-240)
   end if
   if < (x position) < (-240) >
      set x to (240)
   end if
   if < (y position) > (180) >
      set y to (-180)
   end if
   if < (y position) < (-180) >
      set y to (180)
   end if
end forever


http://imageshack.us/a/img694/3806/sigmad.png

Offline

 

#6 2010-09-17 21:58:44

TuffGhost
Scratcher
Registered: 2010-09-06
Posts: 500+

Re: 4d asteroids

ScratchReallyROCKS wrote:

TuffGhost wrote:

Well that only works for the x-axis, and if the player touches the top or bottom, they'd be sent there too  hmm

I'd advise:

forever
   if < (x position) > (480) >
      set x to (-480)
   end if
   if < (x position) < (-480) >
      set x to (480)
   end if
   if < (y position) > (360) >
      set y to (-360)
   end if
   if < (y position) < (-360) >
      set y to (360)
   end if
end forever

That would work for all sides and I'm pretty sure it won't switch back and forth all that much.

Almost, but you got the screen measurements wrong. Here's what it should look like:

forever
   if < (x position) > (240) >
      set x to (-240)
   end if
   if < (x position) < (-240) >
      set x to (240)
   end if
   if < (y position) > (180) >
      set y to (-180)
   end if
   if < (y position) < (-180) >
      set y to (180)
   end if
end forever

Oh haha sorry I forgot to divide by 2


http://i56.tinypic.com/vr8xvs.jpg

Offline

 

Board footer