home *** CD-ROM | disk | FTP | other *** search
/ 100 Plus Great Games 2 / 100PLUSV2.BIN / games / CrazyCreeps.dxr / 00001_main.ls next >
Encoding:
Text File  |  2002-01-25  |  1.6 KB  |  82 lines

  1. global gBallDead, gScore, gLives, gEnemyCount2, gLevel, gWon, gBallSpriteNum
  2.  
  3. on prepareMovie
  4.   initGame()
  5. end
  6.  
  7. on initGame
  8.   sprite(11).blend = 100
  9.   sprite(12).blend = 100
  10.   sprite(13).blend = 100
  11.   sprite(14).blend = 100
  12.   sprite(150).visible = 0
  13.   gLevel = 1
  14.   gBallDead = 0
  15.   gScore = 0
  16.   put "0" into member "Score Display"
  17.   gLives = 3
  18.   put string(gLives) into member "Lives Display"
  19.   put string(gLevel) into member "LevelDisplay"
  20.   sound(1).volume = 64
  21. end
  22.  
  23. on addScore points
  24.   gScore = gScore + points
  25.   updateScoreDisplay(gScore)
  26. end
  27.  
  28. on updateScoreDisplay theScore
  29.   put string(theScore) into member "Score Display"
  30. end
  31.  
  32. on loseALife
  33.   gLives = gLives - 1
  34.   updateLivesDisplay(gLives)
  35. end
  36.  
  37. on addALife
  38.   gLives = gLives + 1
  39.   updateLivesDisplay(gLives)
  40. end
  41.  
  42. on updateLivesDisplay numLives
  43.   put string(numLives) into member "Lives Display"
  44. end
  45.  
  46. on getAngle loc1, loc2
  47.   deltaX = loc2[1] - loc1[1]
  48.   deltaY = -1 * (loc2[2] - loc1[2])
  49.   if deltaY = 0 then
  50.     if deltaX > 0 then
  51.       return 0
  52.     end if
  53.     if deltaX < 0 then
  54.       return 180
  55.     end if
  56.   end if
  57.   if deltaX = 0 then
  58.     deltaX = 0.01
  59.   end if
  60.   theAngle = atan(float(deltaY) / float(deltaX))
  61.   theAngle = theAngle * 180 / PI
  62.   if (deltaX < 0) and (deltaY > 0) then
  63.     theAngle = 180 + theAngle
  64.   else
  65.     if (deltaX < 0) and (deltaY < 0) then
  66.       theAngle = 180 + theAngle
  67.     else
  68.       if (deltaX > 0) and (deltaY < 0) then
  69.         theAngle = 360 + theAngle
  70.       end if
  71.     end if
  72.   end if
  73.   return theAngle
  74. end
  75.  
  76. on waitAWhile me
  77.   theTime10 = the ticks
  78.   repeat while (theTime10 + 60) > the ticks
  79.     nothing()
  80.   end repeat
  81. end
  82.