2011-05-08 15:19:31 +00:00
|
|
|
Tunnel = {}
|
|
|
|
|
2011-05-10 19:05:41 +00:00
|
|
|
TUNNEL_PROBABILITY = 4
|
2011-05-11 21:03:30 +00:00
|
|
|
tunnel_start_back = love.graphics.newQuad(0,0,58,100,512,512)
|
|
|
|
tunnel_end = love.graphics.newQuad(58,0,133,100,512,512)
|
2011-05-08 15:19:31 +00:00
|
|
|
|
|
|
|
function Tunnel.create()
|
|
|
|
local self = {}
|
2011-05-10 21:00:53 +00:00
|
|
|
self.x = WIDTH+58
|
2011-05-08 15:19:31 +00:00
|
|
|
self.alive = true
|
|
|
|
return self
|
|
|
|
end
|
|
|
|
|
|
|
|
function Tunnel.update(self,dt)
|
|
|
|
if self.alive == false then
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
|
|
|
self.x = self.x - global_speed * dt * TRACK_SPEED
|
|
|
|
|
2011-05-11 21:03:30 +00:00
|
|
|
if self.x < -150 then
|
2011-05-08 15:19:31 +00:00
|
|
|
self.alive = false
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
function Tunnel.drawBack(self)
|
|
|
|
if self.alive == true then
|
|
|
|
love.graphics.drawq(imgTerrain,tunnel_start_back,self.x-58,0)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
function Tunnel.drawFront(self)
|
|
|
|
if self.alive == true then
|
2011-05-11 21:03:30 +00:00
|
|
|
love.graphics.drawq(imgTerrain,tunnel_end,self.x,0)
|
2011-05-08 15:19:31 +00:00
|
|
|
end
|
|
|
|
end
|