[ create a new paste ] login | about

Link: http://codepad.org/MbtU3Lrc    [ raw code | output | fork ]

Lua, pasted on Jan 4:
startTime = Time.time  --records when the wave started
endTime = 5  --when the attack ends
 
function Update()
    local t = Time.time - startTime
    if (t < endTime) then

        chasingbullet = CreateProjectile('bullet', Arena.width/2, Arena.height/2)
		chasingbullet.SetVar('xspeed', 0)
		chasingbullet.SetVar('yspeed', 0)

		function Update()
			local xdifference = Player.x - chasingbullet.x
			local ydifference = Player.y - chasingbullet.y
			local xspeed = chasingbullet.GetVar('xspeed') / 2 + xdifference / 100
			local yspeed = chasingbullet.GetVar('yspeed') / 2 + ydifference / 100
			chasingbullet.Move(xspeed, yspeed)
			chasingbullet.SetVar('xspeed', xspeed)
			chasingbullet.SetVar('yspeed', yspeed)
		end

    else
        SetGlobal('phase', 1)
        State("ENEMYDIALOGUE")
    end
end


Output:
1
2
3
4
line 1: attempt to index global 'Time' (a nil value)
stack traceback:
	t.lua:1: in main chunk
	[C]: ?


Create a new paste based on this one


Comments: