Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --An empty wave to serve as a skeleton
- mask = CreateProjectile('orangeheart', 0, 0) --Here we make the orange heart.
- mask.SetVar('ignore', true) --Image available at http://imgur.com/u6BLB1T
- 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
- if Player.x == lastx and Player.y == lasty then --Stopping against the border should hurt
- Player.Hurt(1)
- 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) --Change this as you see fit
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment