home *** CD-ROM | disk | FTP | other *** search
/ Mundo do CD-ROM 24 / CDROM24.iso / jogos / bbaloon / BalBop.exe / BalBop.DCR / Internal_23_baloney.ls < prev    next >
Encoding:
Text File  |  1997-10-21  |  4.8 KB  |  165 lines

  1. property baloneypos, baloneyinc, baloneydest, chan, doing, castset, facing, oldfacing, nextdecision, myhead, animstep, nextanim, walkanim, hitAnim, animdoing, reacting, mylasthit
  2. global animlist
  3.  
  4. on new me, mychan, Twalkanim, Thitanim
  5.   set chan to mychan
  6.   puppetSprite(chan, 1)
  7.   set baloneypos to point(-100, -100)
  8.   set baloneyinc to point(0, 0)
  9.   set doing to 0
  10.   set castset to []
  11.   set animstep to 1
  12.   set nextanim to 1
  13.   set walkanim to getaProp(animlist, Twalkanim)
  14.   set hitAnim to getaProp(animlist, Thitanim)
  15.   set animdoing to walkanim
  16.   set reacting to 0
  17.   return me
  18. end
  19.  
  20. on GetLocation me
  21.   return baloneypos
  22. end
  23.  
  24. on Pickup me
  25.   return doing
  26. end
  27.  
  28. on foreplay me, initstring
  29.   global KBaloneyChan, KBirdyChan
  30.   set castset to the number of member "baloneyset"
  31.   set baloneyinc to point(0, 0)
  32.   case chan of
  33.     KBirdyChan, (KBirdyChan + 1):
  34.       set baloneypos to point(520, 40)
  35.       set baloneyinc to point(10, 0)
  36.     KBaloneyChan:
  37.       set baloneypos to point(520, 480)
  38.   end case
  39.   set doing to 1
  40.   set nextdecision to the timer + 60
  41.   set myhead to 0
  42.   set facing to -1
  43.   set oldfacing to -1
  44.   set mylasthit to 0
  45. end
  46.  
  47. on dork me, sourceObj, dorktype
  48.   global KBaloneyChan, KBirdyChan, PowerupRef, score, baloneyhits, baloneysndHits
  49.   case chan of
  50.     KBirdyChan, (KBirdyChan + 1):
  51.       addscore(100, baloneypos)
  52.       set the anvilinc of sourceObj to point(0, 2) + (the anvilinc of sourceObj * point(1, -1)) + point(random(5) - 3, random(5 - 3))
  53.       soundplay(SndHitBirdy)
  54.       set animdoing to hitAnim
  55.     KBaloneyChan:
  56.       case dorktype of
  57.         0:
  58.           case PowerupRef of
  59.             4:
  60.               addscore(300, baloneypos)
  61.               set animdoing to getAt(baloneyhits, 3)
  62.               soundplay(getAt(baloneysndHits, 3))
  63.               PowerDown(-1)
  64.             5:
  65.               addscore(500, baloneypos)
  66.               set animdoing to getAt(baloneyhits, 1)
  67.               soundplay(getAt(baloneysndHits, 1))
  68.               PowerDown(-1)
  69.             6:
  70.               addscore(300, baloneypos)
  71.               set animdoing to getAt(baloneyhits, 4)
  72.               soundplay(getAt(baloneysndHits, 4))
  73.               PowerDown(-1)
  74.             otherwise:
  75.               capture(sourceObj, baloneypos)
  76.               set animdoing to hitAnim
  77.           end case
  78.         3:
  79.           repeat with xxx = 1 to 5
  80.             addscore(11, baloneypos)
  81.           end repeat
  82.           if PowerupRef = 5 then
  83.             addscore(500, baloneypos)
  84.             set animdoing to getAt(baloneyhits, 1)
  85.             soundplay(getAt(baloneysndHits, 1))
  86.             PowerDown(-1)
  87.           else
  88.             addscore(300, baloneypos)
  89.             set animdoing to getAt(baloneyhits, 2)
  90.             soundplay(getAt(baloneysndHits, 2) - 1 + random(8))
  91.           end if
  92.       end case
  93.   end case
  94.   set reacting to 1
  95.   set mylasthit to 0
  96.   set animstep to 0
  97.   set oldfacing to 0
  98.   set nextdecision to the timer + 360
  99. end
  100.  
  101. on love me, forceupdate
  102.   global anviltime, anvilcount, baloneyspeed, playerobj, KBaloneyChan, KBirdyChan, PowerupRef
  103.   if forceupdate then
  104.     set the loc of sprite chan to baloneypos
  105.     if animstep < 1 then
  106.       set animstep to 1
  107.     end if
  108.     set the memberNum of sprite chan to getAt(animdoing, animstep)
  109.     exit
  110.   end if
  111.   if PowerupRef = 5 then
  112.     exit
  113.   end if
  114.   if doing > 0 then
  115.     case chan of
  116.       KBirdyChan, (KBirdyChan + 1):
  117.         if not reacting then
  118.           if mylasthit < 300 then
  119.             set mylasthit to mylasthit + 1
  120.           end if
  121.           set baloneypos to baloneypos + baloneyinc
  122.           if the locH of baloneypos > 700 then
  123.             set the locH of baloneypos to -40
  124.             set the locV of baloneypos to 25 + (random(4) * 30)
  125.           else
  126.             if random(301 - mylasthit) = 1 then
  127.               addblock(baloneypos)
  128.             end if
  129.           end if
  130.           set the loc of sprite chan to baloneypos
  131.         end if
  132.       KBaloneyChan:
  133.         if not reacting then
  134.           set baloneyinc to baloneyspeed * point(sgn(the locH of sprite 100 - the locH of baloneypos), 0)
  135.           set baloneypos to baloneypos + baloneyinc
  136.           set the loc of sprite chan to baloneypos
  137.         end if
  138.     end case
  139.     if the timer > nextanim then
  140.       set nextanim to the timer + 6
  141.       set animstep to animstep + 1
  142.       if animstep > count(animdoing) then
  143.         if reacting > 0 then
  144.           set reacting to 0
  145.           if chan = KBaloneyChan then
  146.             release(playerobj, baloneypos + point(0, -100))
  147.           end if
  148.           set animdoing to walkanim
  149.         end if
  150.         set animstep to 1
  151.       end if
  152.       if getAt(animdoing, animstep) > 10000 then
  153.         set animstep to animstep + 1
  154.       end if
  155.       set the memberNum of sprite chan to getAt(animdoing, animstep)
  156.       set the loc of sprite chan to baloneypos
  157.     end if
  158.   end if
  159. end
  160.  
  161. on climax me
  162.   set doing to 0
  163.   set the loc of sprite chan to point(-100, -100)
  164. end
  165.