Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- wavetimer = 0
- --H rook
- hRook = CreateProjectile("R", 60, 40)
- hRook.SetVar('hxspeed', 0)
- hRook.SetVar('hyspeed', 0)
- --A Rook
- aRook = CreateProjectile("R", -60, 40)
- aRook.SetVar('axspeed', 0)
- aRook.SetVar('ayspeed', 0)
- function Update()
- --Rooks follow the player in their own x and y coordinates
- if wavetimer < 60 then
- local HxDif = Player.x - hRook.x
- local HyDif = Player.y - hRook.y
- local hxspeed = hRook.GetVar('hxspeed') / 2 + HxDif / 50
- local hyspeed = hRook.GetVar('hyspeed') / 2 + HyDif / 50
- hRook.Move(hxspeed, 0)
- hRook.SetVar('hxspeed', hxspeed)
- hRook.SetVar('hyspeed', hyspeed)
- local AxDif = Player.x - aRook.x
- local AyDif = Player.y - aRook.y
- local axspeed = aRook.GetVar('axspeed') / 2 + AxDif / 50
- local ayspeed = aRook.GetVar('ayspeed') / 2 + AyDif / 50
- aRook.Move(0, ayspeed)
- aRook.SetVar('axspeed', axspeed)
- aRook.SetVar('ayspeed', ayspeed)
- --Rooks move forward to actually attack the player
- elseif wavetimer < 180 then
- hRook.Move(0, -1)
- aRook.Move(1, 0)
- if hRook.y < -40 then
- hRook.MoveTo(hRook.x, -40)
- end
- --Rooks stop
- elseif wavetimer < 240 then
- local HxDif = Player.x - hRook.x
- local HyDif = Player.y - hRook.y
- local hxspeed = hRook.GetVar('hxspeed') / 2 + HxDif / 50
- local hyspeed = hRook.GetVar('hyspeed') / 2 + HyDif / 50
- hRook.Move(hxspeed, 0)
- hRook.SetVar('hxspeed', hxspeed)
- hRook.SetVar('hyspeed', hyspeed)
- local AxDif = Player.x - aRook.x
- local AyDif = Player.y - aRook.y
- local axspeed = aRook.GetVar('axspeed') / 2 + AxDif / 50
- local ayspeed = aRook.GetVar('ayspeed') / 2 + AyDif / 50
- aRook.Move(0, ayspeed)
- aRook.SetVar('axspeed', axspeed)
- aRook.SetVar('ayspeed', ayspeed)
- elseif wavetimer < 360 then
- hRook.Move(0, 1)
- aRook.Move(-1, 0)
- if hRook.y > 40 then --This code shouldn't work, the coordinates given are completely wrong. And yet work it does. Strange, I won't touch it tho
- hRook.MoveTo(hRook.x, 40)
- end
- if aRook.x < -60 then
- aRook.MoveTo(aRook.X,40)
- end
- --I'm ngl this doesn't really serve a purpose? It just let's the moves above actually play
- else
- if hRook.x ~= 60 then
- hRook.Move(1,0)
- elseif hRook.y ~= 40 then
- hRook.Move(0,1)
- elseif aRook.y ~= 40 then
- aRook.Move(0,1)
- elseif aRook.y ~= -60 then
- aRook.Move(-1,0)
- end
- end
- wavetimer = wavetimer + 1
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement