home *** CD-ROM | disk | FTP | other *** search
/ Internet 1996 World Exposition / park.org.s3.amazonaws.com.7z / park.org.s3.amazonaws.com / Cdrom / Pavilions / IBM / Konishiki / konishiki.dcr / Internal_17_character.ls < prev    next >
Encoding:
Text File  |  2017-09-21  |  3.6 KB  |  151 lines

  1. property speed, x, y, howoften, chanel, break, delay, castnumber, point, shake, type
  2.  
  3. on birth me, v_speed, v_x, v_y, v_howoften, v_chanel, v_break, v_delay, v_castnumber, v_point, v_shake, v_type
  4.   set speed to v_speed
  5.   set x to v_x
  6.   set y to v_y
  7.   set howoften to v_howoften
  8.   set chanel to v_chanel
  9.   set break to v_break
  10.   set delay to v_delay
  11.   set castnumber to v_castnumber
  12.   set point to v_point
  13.   set shake to v_shake
  14.   set type to v_type
  15.   puppetSprite(chanel, 1)
  16.   set the locH of sprite chanel to x
  17.   set the locV of sprite chanel to y
  18.   return me
  19. end
  20.  
  21. on takeabreak
  22.   if random(howoften) = 1 then
  23.     set break to 50
  24.   else
  25.     set break to 0
  26.   end if
  27. end
  28.  
  29. on sethitmarkposition
  30.   global hitmark
  31.   set the locV of sprite hitmark to mouseV()
  32.   set the locH of sprite hitmark to mouseH()
  33. end
  34.  
  35. on resethitmarkposition
  36.   global hitmark
  37.   set the locV of sprite hitmark to 0
  38.   set the locH of sprite hitmark to 500
  39. end
  40.  
  41. on hit
  42.   global score, defy
  43.   if shake = 0 then
  44.     puppetSound("hit")
  45.     set the castNum of sprite chanel to castnumber + 1
  46.     set delay to 4
  47.     set score to score + point
  48.     set the text of cast "score feild" to string(score)
  49.   else
  50.     puppetSound("hit")
  51.     set the castNum of sprite chanel to castnumber + 1
  52.     set delay to 8
  53.     set score to score + (point * -1)
  54.     set the text of cast "score feild" to string(score)
  55.   end if
  56.   sethitmarkposition()
  57. end
  58.  
  59. on hitufo
  60.   global score, ufo
  61.   sethitmarkposition()
  62.   puppetSound("hit")
  63.   set score to score + 50
  64.   set the text of cast "score feild" to string(score)
  65.   set the locH of sprite ufo to -20
  66.   set the locV of sprite ufo to 150 - (random(60) / 2)
  67. end
  68.  
  69. on moveufo
  70.   global n, ufoh, ufo
  71.   if the locH of sprite ufo < 0 then
  72.     if random(10) = 1 then
  73.       set ufoh to 420
  74.     else
  75.       set ufoh to 1000
  76.     end if
  77.     set the locH of sprite ufo to ufoh
  78.     set the locV of sprite ufo to 150 - (random(60) / 2)
  79.   else
  80.     set the locH of sprite ufo to the locH of sprite ufo - 12
  81.     set the locV of sprite ufo to the locV of sprite ufo + (sin(n) * 10 / 2)
  82.     set n to n + 1
  83.   end if
  84. end
  85.  
  86. on stepFrame me
  87.   global defy, defspace, counter, defmargin, defscreenwidth
  88.   if break = 0 then
  89.     if shake = 0 then
  90.       set y to y + speed
  91.     end if
  92.     if y > 170 then
  93.       if shake = 0 then
  94.         if random(1) = 1 then
  95.           set shake to 10
  96.         else
  97.           set y to defy + random(50)
  98.           set x to random(defscreenwidth) + defmargin
  99.           set x to alignx(x)
  100.         end if
  101.       else
  102.         if type = "stable" then
  103.           set shake to shake - 1
  104.         else
  105.           if (shake mod 2) = 0 then
  106.             set x to x + 4
  107.           else
  108.             set x to x - 4
  109.           end if
  110.           set shake to shake - 1
  111.         end if
  112.         if shake = 0 then
  113.           set y to defy + random(50)
  114.           set x to random(defscreenwidth) + defmargin
  115.           set x to alignx(x)
  116.         end if
  117.       end if
  118.     end if
  119.   else
  120.     set break to break - 1
  121.     if break = 0 then
  122.       set the locV of sprite chanel to defy
  123.       set x to random(defscreenwidth) + defmargin
  124.       set x to alignx(x)
  125.       set the castNum of sprite chanel to castnumber
  126.     end if
  127.   end if
  128.   if delay <> 0 then
  129.     set delay to delay - 1
  130.     if delay = 0 then
  131.       set the locV of sprite chanel to defy
  132.       set x to random(defscreenwidth) + defmargin
  133.       set the castNum of sprite chanel to castnumber
  134.       resethitmarkposition()
  135.     end if
  136.   else
  137.     set the locV of sprite chanel to y
  138.     set the locH of sprite chanel to x
  139.   end if
  140. end
  141.  
  142. on alignx x
  143.   if x < 30 then
  144.     set x to 30
  145.   end if
  146.   if x > 370 then
  147.     set x to 370
  148.   end if
  149.   return x
  150. end
  151.