2022-10-13 16:06:52 +02:00
|
|
|
Planet = Object.extend(Object)
|
|
|
|
|
|
|
|
function Planet:new()
|
2022-10-13 20:59:14 +02:00
|
|
|
Planet.super.new(self)
|
|
|
|
end
|
|
|
|
|
|
|
|
function Planet:init()
|
|
|
|
self.canvas = love.graphics.newCanvas(windowWidth, windowHeight)
|
|
|
|
|
|
|
|
self.map = {
|
|
|
|
{0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0},
|
|
|
|
{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},
|
|
|
|
{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},
|
|
|
|
{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},
|
|
|
|
{0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},
|
|
|
|
{0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},
|
|
|
|
{0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},
|
|
|
|
{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},
|
|
|
|
{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},
|
|
|
|
{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,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|
{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},
|
|
|
|
{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0}
|
|
|
|
}
|
|
|
|
|
|
|
|
self.spritemap = {
|
|
|
|
s1= tileGroundFull
|
|
|
|
}
|
2022-10-13 16:06:52 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
function Planet:update(dt)
|
|
|
|
end
|
|
|
|
|
|
|
|
function Planet:draw()
|
2022-10-13 20:59:14 +02:00
|
|
|
love.graphics.setCanvas(self.canvas)
|
|
|
|
--self.canvas:clear()
|
|
|
|
|
|
|
|
love.graphics.setColor(1,1,1,1)
|
|
|
|
|
|
|
|
local sprite = nil
|
|
|
|
local pos = 0
|
|
|
|
for y=1, 20 do
|
|
|
|
for x=1, 25 do
|
|
|
|
sprite = nil
|
|
|
|
pos = self.map[y][x]
|
|
|
|
if pos > 0 then
|
|
|
|
sprite = self.spritemap["s"..pos]
|
|
|
|
love.graphics.draw(sprite, (x-1)*32, (600-98) - (y-1)*32)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
love.graphics.setCanvas()
|
2022-10-13 16:06:52 +02:00
|
|
|
end
|