diff --git a/assets.lua b/assets.lua index 75a23ec..e647600 100644 --- a/assets.lua +++ b/assets.lua @@ -8,7 +8,8 @@ multilily = lily.loadMulti({ {lily.newImage, "assets/ships/blackstar-5.png"}, {lily.newImage, "assets/ships/excalibur-iv.png"}, {lily.newImage, "assets/ships/decorator.png"}, - {lily.newImage, "assets/ships/particle.png"} + {lily.newImage, "assets/ships/particle.png"}, + {lily.newImage, "assets/tiles/gf.png"} }) multilily:onComplete(function(_, lilies) gameLogo = lilies[1][1] @@ -22,6 +23,8 @@ multilily:onComplete(function(_, lilies) CaptainJohn.ship.image = lilies[9][1] boosterParticle = lilies[10][1] + tileGroundFull = lilies[11][1] + windowWidth = love.graphics.getWidth() windowHeight = love.graphics.getHeight() diff --git a/assets/ships/particle.png b/assets/ships/particle.png index e6003a5..a40ddd0 100644 Binary files a/assets/ships/particle.png and b/assets/ships/particle.png differ diff --git a/assets/tiles/gf.png b/assets/tiles/gf.png new file mode 100644 index 0000000..2eac370 Binary files /dev/null and b/assets/tiles/gf.png differ diff --git a/main.lua b/main.lua index e3a6ca2..8b97eab 100644 --- a/main.lua +++ b/main.lua @@ -39,6 +39,8 @@ function love.load() require "ship/excaliburiv" require "ship/decorator" + require "planet/planet" + LoadScene = LoadScene() TitleScene = TitleScene() GameScene = GameScene() @@ -48,6 +50,7 @@ function love.load() currentScene = LoadScene; currentPlayer = CaptainSteve; + currentPlanet = Planet() require "assets" end diff --git a/planet/planet.lua b/planet/planet.lua index 40ccd70..db6ae0c 100644 --- a/planet/planet.lua +++ b/planet/planet.lua @@ -1,10 +1,65 @@ Planet = Object.extend(Object) function Planet:new() + 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,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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}, + {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, 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, 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 + } end function Planet:update(dt) end function Planet:draw() + 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() end diff --git a/scene/game.lua b/scene/game.lua index de02ffc..47fd2d8 100644 --- a/scene/game.lua +++ b/scene/game.lua @@ -27,16 +27,29 @@ function GameScene:init() 1,1,1,0.4, 1,1,1,0.3 ) + + currentPlanet:init() + currentPlanet:draw() end function GameScene:update(dt) pSystem:update(dt) GameScene:updateInput(dt) GameScene:updateBounds(dt) + + if currentPlanet ~= nil then + love.graphics.print("hebebs",100,100); + currentPlanet.update(dt) + end end function GameScene:draw() love.graphics.setColor(255,255,255, 1) + + if currentPlanet ~= nil and currentPlanet.canvas ~= nil then + love.graphics.draw(currentPlanet.canvas,0,0) + end + love.graphics.draw(pSystem, currentPlayer.px-2, currentPlayer.py) love.graphics.draw(pSystem, currentPlayer.px+2, currentPlayer.py) love.graphics.draw(