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

#1 2013-05-04 20:25:58

stacey01
New Scratcher
Registered: 2013-04-17
Posts: 1

Help with a script!!

Im hoping someone out there could help me out with my game project im making a sorta space invader game where im trying to find a script that'll make my sprite move along the screen in a straight line and when it gets to edge of screen move down a few steps then back along the screen, but I also want teh sprite to randomly drop down the screen! Is this possible? Any help would be much appreciated.

Offline

 

#2 2013-05-05 14:15:55

cauzality
New Scratcher
Registered: 2013-03-19
Posts: 44

Re: Help with a script!!

here's one way to do it:

when i receive [spawn guy v]
go to x: [-200] y: [150]
repeat until <(y position) < [-149] >
   repeat until <touching [edge v]?>
      change x by [25]
      repeat [10]
         check if hit
      end
      if <(pick random [1] to [20]) = [1]>
         change y by [-50]
      end
   end
   change x by [-25]
   change y by [-50]
   repeat until <touching [edge v]?>
      change x by [-25]
      repeat [10]
         check if hit
      end
      if <(pick random [1] to [20]) = [1]>
         change y by [-50]
      end
   end
   change x by [25]
   change y by [-50]
end

Offline

 

Board footer