Guest User

Orange Mode Skeleton V2

a guest
Jan 2nd, 2016
337
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.71 KB | None | 0 0
  1. --An empty wave to serve as a skeleton
  2.  
  3. --Stopping against the border needs to hurt, so here a we make a hurtbox for the border.
  4. lborder = CreateProjectile('vborder', -Arena.width/2, 0)
  5. rborder = CreateProjectile('vborder', Arena.width/2, 0)
  6. tborder = CreateProjectile('hborder', 0, Arena.height/2)
  7. bborder = CreateProjectile('hborder', 0, -Arena.height/2)
  8. border = {lborder, rborder, tborder, bborder}   --I add them to a border table to make things prettier later on.
  9.  
  10. mask = CreateProjectile('orangeheart', 0, 0)    --Here we make the orange heart.
  11. mask.SetVar('ignore', true)
  12.  
  13. unmoved = true  --Initializing variables
  14. num = math.random()
  15. xstart = 1.5*math.sin(2*math.pi*num)
  16. ystart = 1.5*math.cos(2*math.pi*num)
  17. lastx = 0
  18. lasty = 0
  19.  
  20. function Update()
  21.     if Player.isMoving then --This keeps track of if the player has moved at all
  22.         unmoved = false
  23.     end
  24.     if unmoved then
  25.         Player.MoveTo(Player.x + xstart, Player.y + ystart, false) --The initial direction of movement
  26.     elseif not Player.isMoving then
  27.         Player.MoveTo(2*Player.x - lastx, 2*Player.y - lasty, false) --Keeps the player moving     
  28.     end
  29.     lastx = mask.--I use the mask to set the last positions
  30.     lasty = mask.y
  31.     for i=1, #border do --Here we turn the borders on if the player hasn't moved (by getting into a corner)
  32.         if Player.x == lastx and Player.y == lasty then
  33.             border[i].SetVar('ignore', false)
  34.         else
  35.             border[i].SetVar('ignore', true)
  36.         end
  37.     end
  38.     mask.MoveTo(Player.x, Player.y) --Finally move the mask back to the player
  39. end
  40.  
  41. function OnHit(bullet)
  42.     if bullet.GetVar('ignore') then --I changed this to make copying into other waves eaiser.
  43.     else                            --Now you don't have to add a 'real' variable to each bullet.
  44.         Player.Hurt(1)
  45.     end
  46. end
Advertisement
Add Comment
Please, Sign In to add comment