home *** CD-ROM | disk | FTP | other *** search
/ Knudde EK Editie / CD1.iso / tinus.dxr / Script_5_Birds.ls < prev    next >
Encoding:
Text File  |  2000-02-24  |  2.7 KB  |  109 lines

  1. property MySprite, MyMem, MyType, MyH, MyV, MyStatus, MySpeed
  2. global MyFlip
  3.  
  4. on new me, spr, Side
  5.   MySprite = spr + 20
  6.   MyType = #Bird
  7.   MyMem = 175
  8.   if Side = #right then
  9.     MyH = (spr * (235 + random(30))) + 640 - 150
  10.     MySpeed = 1 + random(2)
  11.   else
  12.     if Side = #left then
  13.       MyH = 0 + 150 - (spr * (235 + random(30)))
  14.       MySpeed = 1 + random(2)
  15.     end if
  16.   end if
  17.   MyV = 100
  18.   MyStatus = #normal
  19.   sprite(MySprite).member = member(MyMem, 1)
  20.   sprite(MySprite).loc = point(MyH, MyV)
  21.   sprite(MySprite).flipH = MyFlip
  22.   return me
  23. end
  24.  
  25. on Update me
  26.   global Scrolling, Direction, MaaierSpr, MaaierMem, MaaierStatus, TinusSpr, TinusMem, TinusStatus, TinusOnsterf
  27.   MyH = MyH + Scrolling
  28.   if MyStatus = #normal then
  29.     if sprite MySprite intersects TinusSpr and (TinusStatus = #normal) and (TinusOnsterf = 0) then
  30.       puppetSound(1, 108 + random(3))
  31.       TinusMem = 37
  32.       TinusStatus = #BackDrop
  33.       MyStatus = #GetOutBird
  34.       MaaierStatus = #RunAway
  35.       TinusOnsterf = 100
  36.     end if
  37.   end if
  38.   if MyMem > 177 then
  39.     MyMem = 175
  40.   else
  41.     MyMem = MyMem + 0.29999999999999999
  42.   end if
  43.   if (MySprite = 50) and (MyH < -60) and (Direction = #right) and (MyStatus = #normal) then
  44.     MyStatus = #OutScreen
  45.     TinusStatus = #OutScreenRight
  46.     Scrolling = 0
  47.   else
  48.     if (MySprite = 50) and (MyH > 700) and (Direction = #left) and (MyStatus = #normal) then
  49.       MyStatus = #OutScreen
  50.       TinusStatus = #OutScreenLeft
  51.       Scrolling = 0
  52.     else
  53.       if MyStatus = #GetOutBird then
  54.         MyV = MyV - 1
  55.         if Direction = #right then
  56.           MyH = MyH - MySpeed
  57.         else
  58.           if Direction = #left then
  59.             MyH = MyH + MySpeed
  60.           end if
  61.         end if
  62.       end if
  63.     end if
  64.   end if
  65.   if (MyH < 700) and (MyH > -60) then
  66.     DoBird(me, Direction)
  67.     sprite(MySprite).member = member(MyMem, 1)
  68.     sprite(MySprite).loc = point(MyH, MyV)
  69.     sprite(MySprite).flipH = MyFlip
  70.   end if
  71. end
  72.  
  73. on stepFrame me
  74.   Update(me)
  75. end
  76.  
  77. on DoBird me, dir
  78.   global Scrolling, TinusStatus
  79.   if (dir = #right) and (TinusStatus = #normal) then
  80.     MyH = MyH - (MySpeed / 2.0)
  81.     if (MyH < 640) and (MyH > 200) then
  82.       if MyV >= 275 then
  83.         MyV = 275
  84.       else
  85.         MyV = MyV + ((MySpeed / 2.0) + (abs(Scrolling) / 3.0))
  86.       end if
  87.     else
  88.       if MyH <= 200 then
  89.         MyV = MyV - 1
  90.       end if
  91.     end if
  92.   else
  93.     if (dir = #left) and (TinusStatus = #normal) then
  94.       MyH = MyH + (MySpeed / 2.0)
  95.       if (MyH < 440) and (MyH > 0) then
  96.         if MyV >= 275 then
  97.           MyV = 275
  98.         else
  99.           MyV = MyV + ((MySpeed / 2.0) + (Scrolling / 3.0))
  100.         end if
  101.       else
  102.         if MyH >= 440 then
  103.           MyV = MyV - 1
  104.         end if
  105.       end if
  106.     end if
  107.   end if
  108. end
  109.