home *** CD-ROM | disk | FTP | other *** search
/ Shocking The Web CD-ROM / SHOCK_CD.ISO / pc / tutorial / devglry / mcny / source / newduck.dir / 00011.ls < prev    next >
Encoding:
Text File  |  1996-05-06  |  1.9 KB  |  79 lines

  1. on mouseDown
  2.   global shots
  3.   set shots to shots - 1
  4.   if shots >= 1 then
  5.     puppetSound("gunshot.aif")
  6.     updateStage()
  7.   else
  8.     puppetSound("clickup.aif")
  9.   end if
  10.   updateStage()
  11. end
  12.  
  13. on enterFrame
  14.   global wayV, speed, vertchange, ammo
  15.   puppetSprite(1, 1)
  16.   puppetSprite(2, 1)
  17.   puppetSprite(3, 1)
  18.   puppetSprite(4, 1)
  19.   if the locH of sprite 2 > 450 then
  20.     set the castNum of sprite 2 to 3
  21.     set speed to random(10) + (10 * -1)
  22.     set wayV to random(250)
  23.     set vertchange to (wayV - the locV of sprite 2) / 20
  24.   else
  25.     if the locH of sprite 2 < -50 then
  26.       set the castNum of sprite 2 to 1
  27.       set speed to random(10) + 10
  28.       set wayV to random(250)
  29.       set vertchange to (wayV - the locV of sprite 2) / 20
  30.     else
  31.       if the locV of sprite 2 > 260 then
  32.         set wayV to random(250)
  33.         set vertchange to (wayV - the locV of sprite 2) / 20
  34.       else
  35.         if the locV of sprite 2 < 20 then
  36.           set wayV to random(250)
  37.           set vertchange to (wayV - the locV of sprite 2) / 20
  38.         end if
  39.       end if
  40.     end if
  41.   end if
  42.   set the locV of sprite 2 to the locV of sprite 2 + vertchange
  43.   set the locH of sprite 2 to the locH of sprite 2 + speed
  44.   updateStage()
  45.   set the locH of sprite 3 to the mouseH
  46.   set the locV of sprite 3 to the mouseV
  47.   set random to random(100)
  48.   if random > 99 then
  49.     set ammo to 1
  50.   else
  51.     if random < 3 then
  52.       set ammo to 0
  53.     end if
  54.   end if
  55.   if ammo = 1 then
  56.     set the locV of sprite 4 to random(200) + 50
  57.     set the locH of sprite 4 to random(350)
  58.     set ammo to 2
  59.   else
  60.     if ammo = 0 then
  61.       set the locH of sprite 4 to -100
  62.       set the locV of sprite 4 to -100
  63.       updateStage()
  64.     end if
  65.   end if
  66. end
  67.  
  68. on exitFrame
  69.   global shots, score
  70.   set display to shots - 1
  71.   set the text of cast "shots" to string(display)
  72.   set the text of cast "score" to string(score)
  73.   if shots <= 0 then
  74.     go("gameover")
  75.   else
  76.     go("move")
  77.   end if
  78. end
  79.