feat(shootmap): add cliff drawing
This commit is contained in:
parent
52fdc3d681
commit
78d2f5ae93
1 changed files with 13 additions and 1 deletions
|
@ -10,7 +10,7 @@ function ShootMap:new(world, maptype, mapname)
|
|||
ShootMap.super.new(self, world)
|
||||
|
||||
self:setPadding(0, 0, 0, 0)
|
||||
self:generateTextures(1, "city")
|
||||
self:generateTextures(2, "tunnel")
|
||||
end
|
||||
|
||||
function ShootMap:loadCollisions()
|
||||
|
@ -89,6 +89,7 @@ function ShootMap:addParallax(filename)
|
|||
filename = backfolder .. filename
|
||||
self.texture.back1 = love.graphics.newImage(filename .. "-back.png")
|
||||
self.texture.back2 = love.graphics.newImage(filename .. "-fore.png")
|
||||
self.texture.cliff = love.graphics.newImage(filename .. "-cliff.png")
|
||||
end
|
||||
|
||||
function ShootMap:drawParallax(x, y, w, h)
|
||||
|
@ -103,6 +104,7 @@ function ShootMap:drawParallax(x, y, w, h)
|
|||
|
||||
self:drawBorder(x, y + 10)
|
||||
self:drawBorder(x, y - 100)
|
||||
self:drawCliff(x, y - 110, w, h)
|
||||
end
|
||||
|
||||
function ShootMap:drawBackground(x, y, w, h)
|
||||
|
@ -130,4 +132,14 @@ function ShootMap:drawBorder(x, y)
|
|||
end
|
||||
end
|
||||
|
||||
function ShootMap:drawCliff(x, y, w, h)
|
||||
local w2, h2 = self.texture.cliff:getDimensions()
|
||||
local imax = math.ceil(w / w2) + 1
|
||||
for i=1, imax do
|
||||
local x1 = (x) % w2
|
||||
love.graphics.draw(self.texture.cliff, (i-1)*w2 - x1, -y, 0, 1, 1, 0, 0)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
return ShootMap
|
||||
|
|
Loading…
Reference in a new issue