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(0, 7)
- xstart = 1.5*math.sin(math.pi*num/4)
- ystart = 1.5*math.cos(math.pi*num/4)
- lastx = 0
- lasty = 0
- buffer = 0
- function Update()
- if Player.isMoving then --This keeps track of if the player has moved at all
- unmoved = false
- buffer = 0 --I added a buffer for the controls
- bufferx = Player.x - lastx
- buffery = Player.y - lasty
- end
- if unmoved then
- Player.MoveTo(Player.x + xstart, Player.y + ystart, false) --The initial direction of movement
- elseif not Player.isMoving then
- if buffer < 6 then --Now players have 6/60 = 1/10 sec to release both keys to move diagonally
- Player.MoveTo(Player.x + bufferx/2, Player.y + buffery/2, false)
- else
- Player.MoveTo(2*Player.x - lastx, 2*Player.y - lasty, false) --Keeps the player moving
- end
- 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
- buffer = buffer + 1
- 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