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

  1. property MySprite, MyX, MyY, MydX, MydY, MyStatus
  2.  
  3. on new me, spr
  4.   MySprite = spr + 10
  5.   MyStatus = #Dead
  6.   return me
  7. end
  8.  
  9. on Init me
  10.   global MyChar, Tekst, CastLetter, Gstatus
  11.   if (MyChar <= the number of chars in Tekst) and (Gstatus = #Free) then
  12.     MyX = 680
  13.     MyY = 500
  14.     MydX = 5
  15.     MydY = 15
  16.     MyStatus = #last
  17.     Gstatus = #Full
  18.     sprite(MySprite).member = member(getProp(CastLetter, symbol(Tekst.char[MyChar])), 1)
  19.     sprite(MySprite).loc = point(MyX, MyY)
  20.     MyChar = MyChar + 1
  21.   else
  22.     if MyChar >= the number of chars in Tekst then
  23.       MyChar = 1
  24.     end if
  25.   end if
  26. end
  27.  
  28. on Update me
  29.   global Gstatus
  30.   if (MyStatus = #Up) or (MyStatus = #last) then
  31.     if (MyY < 370) and (MyStatus = #last) then
  32.       Gstatus = #Free
  33.       MyStatus = #Up
  34.     end if
  35.     if MyY < 200 then
  36.       MyStatus = #Walking
  37.     end if
  38.     MyY = MyY - 15
  39.     MyX = MyX - MydX
  40.     sprite(MySprite).loc = point(MyX, MyY)
  41.     sprite(MySprite).rotation = (270 - (sin(MyX * 15 * PI / 180) * 50) + MyY) * 4
  42.   end if
  43.   if MyStatus = #Walking then
  44.     if MyX < 55 then
  45.       MyStatus = #Falling
  46.     end if
  47.     MyX = MyX - MydX
  48.     if (MyY - MydY) > 240 then
  49.       if abs(MydY) < 1.5 then
  50.         MydY = 0
  51.       end if
  52.       MydY = MydY * -1
  53.       MyY = 241
  54.     else
  55.       if MydY <> 0 then
  56.         MydY = MydY - (0.29999999999999999 * 9)
  57.         MyY = MyY - MydY
  58.       end if
  59.     end if
  60.     sprite(MySprite).loc = point(MyX, MyY)
  61.     sprite(MySprite).rotation = the mouseH
  62.   end if
  63.   if MyStatus = #Falling then
  64.     if MyY > 500 then
  65.       Init(me)
  66.     end if
  67.     MyX = MyX - MydX
  68.     MyY = MyY + 15
  69.     sprite(MySprite).loc = point(MyX, MyY)
  70.     sprite(MySprite).rotation = (270 - (sin(MyX * 15 * PI / 180) * 50) + MyY) * 4
  71.   end if
  72.   if MyStatus = #Dead then
  73.     Init(me)
  74.   end if
  75. end
  76.  
  77. on stepFrame me
  78.   Update(me)
  79. end
  80.