home *** CD-ROM | disk | FTP | other *** search
/ 100 Plus Great Games 2 / 100PLUSV2.BIN / games / Stonewall.dxr / Internal_24_insect.ls < prev    next >
Encoding:
Text File  |  2002-01-25  |  1.7 KB  |  45 lines

  1. property pInsect, spriteNum, pRotInc, pRotDif, pDistance, pOgLoc, pTimer, pLocation
  2.  
  3. on getPropertyDescriptionList me
  4.   return [#pRotInc: [#comment: "rotation inc", #format: #integer, #default: 0], #pRotDif: [#comment: "rotation dif", #format: #integer, #default: 0], #pDistance: [#comment: "rotation dis", #format: #integer, #default: 0]]
  5. end
  6.  
  7. on beginSprite me
  8.   pInsect = sprite(spriteNum)
  9.   pOgLoc = pInsect.loc
  10.   pLocation = [float(pInsect.locH), float(pInsect.locV)]
  11.   pTimer = 0
  12. end
  13.  
  14. on enterFrame me
  15.   pTimer = pTimer + 1
  16.   if pTimer = pDistance then
  17.     pInsect.rotation = pInsect.rotation + (random(pRotInc) - pRotDif)
  18.     pTimer = 0
  19.   end if
  20.   xPos = -sin(float(pInsect.rotation) * PI / 180.0)
  21.   yPos = cos(float(pInsect.rotation) * PI / 180.0)
  22.   pLocation = pLocation + [xPos, yPos]
  23.   pInsect.loc = point(pLocation[1], pLocation[2])
  24.   if (pInsect.locV < (0 - (pInsect.height * 2))) or (pInsect.locV > ((the stage).rect.height + (pInsect.height * 2))) then
  25.     pInsect.rotation = pInsect.rotation - 180
  26.     if pInsect.locV < (0 - pInsect.height) then
  27.       pInsect.locV = 0
  28.       pLocation = [float(pInsect.locH), float(pInsect.locV)]
  29.     else
  30.       pInsect.locV = (the stage).rect.height
  31.       pLocation = [float(pInsect.locH), float(pInsect.locV)]
  32.     end if
  33.   end if
  34.   if (pInsect.locH < (0 - (pInsect.width * 2))) or (pInsect.locH > ((the stage).rect.width + (pInsect.width * 2))) then
  35.     pInsect.rotation = pInsect.rotation + 90
  36.     if pInsect.locH < (0 - pInsect.height) then
  37.       pInsect.locH = 0
  38.       pLocation = [float(pInsect.locH), float(pInsect.locV)]
  39.     else
  40.       pInsect.locH = (the stage).rect.width
  41.       pLocation = [float(pInsect.locH), float(pInsect.locV)]
  42.     end if
  43.   end if
  44. end
  45.