Advertisement
Guest User

Cyan Mode - 2 Waves

a guest
Dec 31st, 2015
1,340
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.61 KB | None | 0 0
  1. --bullet_chaserorb
  2. -- The chasing attack that everyone knows
  3. --Setting up the stage
  4. bg = CreateProjectileAbs("bg_filled", 320, 240)
  5. monster = CreateProjectile("poseur", 0, 186)
  6. fakearena = CreateProjectile("arena", 0, 0)
  7. fakeheart = CreateProjectile("cyanheart", 0, 0)
  8.  
  9. --Creating the chasers
  10. realbullet = CreateProjectile('realbullet', -Arena.width/2, -Arena.height/2) --realbullet.png is just an empty image
  11. realbullet.SetVar('xspeed', 0)
  12. realbullet.SetVar('yspeed', 0)
  13. realbullet.SetVar('real', true) --important for OnHit
  14. fakebullet = CreateProjectile('bullet', Arena.width/2, Arena.height/2)
  15.  
  16. function Update()
  17.     fakearena.MoveTo(Player.x, Player.y) --the "arena" that you control follows the actual heart's movements
  18.     local xdifference = Player.x - realbullet.x
  19.     local ydifference = Player.y - realbullet.y
  20.     local xspeed = realbullet.GetVar('xspeed') / 2 + xdifference / 100
  21.     local yspeed = realbullet.GetVar('yspeed') / 2 + ydifference / 100
  22.     realbullet.Move(xspeed, yspeed)
  23.     realbullet.SetVar('xspeed', xspeed)
  24.     realbullet.SetVar('yspeed', yspeed)
  25.     fakebullet.MoveTo(fakearena.x - realbullet.x, fakearena.y - realbullet.y) --move the visible chaser to mirror the painful one  
  26. end
  27.  
  28. function OnHit(bullet) --important so the stage doesn't kill you
  29.     if bullet.GetVar('real') then
  30.         Player.Hurt(5, 0.5)
  31.     end
  32. end
  33.  
  34. --------------------------------------------------------------------------------------------------------------------------------
  35. --bullet_zoning
  36. --Setting up the stage
  37. bg = CreateProjectileAbs("bg_filled", 320, 240)
  38. monster = CreateProjectile("poseur", 0, 186)
  39. fakearena = CreateProjectile("arena", 0, 0)
  40. fakeheart = CreateProjectile("cyanheart", 0, 0)
  41.  
  42. timer = -15 --Set up a timer
  43. num = 0
  44. area = 0
  45. warned = false --conditionals set-up
  46. zoned = false
  47.  
  48. function Update()
  49.     fakearena.MoveTo(Player.x, Player.y) --moving the "arena" around
  50.     timer = timer + 1 --increment timer
  51.     if timer < 30 then
  52.         if not warned then
  53.             num = math.random() --randomly choose zone
  54.             if num < 0.333 then
  55.                 warning = CreateProjectile("warning", fakearena.x - Arena.width/3, fakearena.y)
  56.                 area = 1
  57.             elseif num < 0.666 then
  58.                 warning = CreateProjectile("warning", fakearena.x, fakearena.y)
  59.                 area = 2
  60.             else
  61.                 warning = CreateProjectile("warning", fakearena.x + Arena.width/3, fakearena.y)
  62.                 area = 3
  63.             end
  64.             warned = true --conditional so only one warning is made
  65.         end
  66.         warning.MoveTo(fakearena.x + (2 - area)*Arena.width/3, fakearena.y) --warning moves with "arena"
  67.     elseif timer < 60 then
  68.         if warned then --removing the warning
  69.             warning.Remove()
  70.             warned = false
  71.         end
  72.         if not zoned then --making the hurtbox
  73.             if area == 1 then
  74.                 badzone = CreateProjectile("badzone", fakearena.x - Arena.width/3, fakearena.y)
  75.                 realbadzone = CreateProjectile("realbadzone", -Arena.width/3, 0)
  76.             elseif area == 2 then
  77.                 badzone = CreateProjectile("badzone", fakearena.x, fakearena.y)        
  78.                 realbadzone = CreateProjectile("realbadzone", 0, 0)    
  79.             else
  80.                 badzone = CreateProjectile("badzone", fakearena.x + Arena.width/3, fakearena.y)
  81.                 realbadzone = CreateProjectile("realbadzone", Arena.width/3, 0)
  82.             end
  83.             zoned = true --same conditional for the zones
  84.         end
  85.         realbadzone.SetVar('real', true) --Hurtbox now hurts
  86.         badzone.MoveTo(fakearena.x + (2 - area)*Arena.width/3, fakearena.y) --moving the fake zone
  87.     else
  88.         if zoned then --removing the zones
  89.             badzone.Remove()
  90.             realbadzone.Remove()
  91.         end
  92.         zoned = false
  93.         timer = -15 --a brief respite
  94.     end
  95. end
  96.  
  97. function OnHit(bullet)
  98.     if bullet.GetVar('real') then
  99.         Player.Hurt(1, 0.1) --ouchies
  100.     end
  101. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement