Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --An empty wave to serve as a skeleton
- --Stopping against the border needs to hurt, so here a we make a hurtbox for the border.
- lborder = CreateProjectile('vborder', -Arena.width/2, 0)
- rborder = CreateProjectile('vborder', Arena.width/2, 0)
- tborder = CreateProjectile('hborder', 0, Arena.height/2)
- bborder = CreateProjectile('hborder', 0, -Arena.height/2)
- border = {lborder, rborder, tborder, bborder} --I add them to a border table to make things prettier later on.
- mask = CreateProjectile('orangeheart', 0, 0) --Here we make the orange heart.
- mask.SetVar('ignore', true)
- unmoved = true --Initializing variables
- num = math.random()
- xstart = 1.5*math.sin(2*math.pi*num)
- ystart = 1.5*math.cos(2*math.pi*num)
- lastx = 0
- lasty = 0
- function Update()
- if Player.isMoving then --This keeps track of if the player has moved at all
- unmoved = false
- end
- if unmoved then
- Player.MoveTo(Player.x + xstart, Player.y + ystart, false) --The initial direction of movement
- elseif not Player.isMoving then
- Player.MoveTo(2*Player.x - lastx, 2*Player.y - lasty, false) --Keeps the player moving
- end
- lastx = mask.x --I use the mask to set the last positions
- lasty = mask.y
- for i=1, #border do --Here we turn the borders on if the player hasn't moved (by getting into a corner)
- if Player.x == lastx and Player.y == lasty then
- border[i].SetVar('ignore', false)
- else
- border[i].SetVar('ignore', true)
- end
- end
- mask.MoveTo(Player.x, Player.y) --Finally move the mask back to the player
- end
- function OnHit(bullet)
- if bullet.GetVar('ignore') then --I changed this to make copying into other waves eaiser.
- else --Now you don't have to add a 'real' variable to each bullet.
- Player.Hurt(1)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment