2011-05-08 15:19:31 +00:00
|
|
|
Tunnel = {}
|
2011-05-11 22:52:54 +00:00
|
|
|
Tunnel.__index = Tunnel
|
2011-05-08 15:19:31 +00:00
|
|
|
|
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-11 22:52:54 +00:00
|
|
|
setmetatable(self,Tunnel)
|
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
|
|
|
|
|
2011-05-11 22:52:54 +00:00
|
|
|
function Tunnel:update(dt)
|
2011-05-08 15:19:31 +00:00
|
|
|
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
|
|
|
|
|
2011-05-11 22:52:54 +00:00
|
|
|
function Tunnel:drawBack()
|
2011-05-08 15:19:31 +00:00
|
|
|
if self.alive == true then
|
2014-07-10 18:25:09 +00:00
|
|
|
love.graphics.draw(imgTerrain,tunnel_start_back,self.x-58,0)
|
2011-05-08 15:19:31 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2011-05-11 22:52:54 +00:00
|
|
|
function Tunnel:drawFront()
|
2011-05-08 15:19:31 +00:00
|
|
|
if self.alive == true then
|
2014-07-10 18:25:09 +00:00
|
|
|
love.graphics.draw(imgTerrain,tunnel_end,self.x,0)
|
2011-05-08 15:19:31 +00:00
|
|
|
end
|
|
|
|
end
|