This commit is contained in:
Martijn de Boer 2022-10-13 20:59:14 +02:00
parent 5d6c97d086
commit 3f590d507f
No known key found for this signature in database
GPG key ID: 9D2E42402DD372D1
6 changed files with 75 additions and 1 deletions

View file

@ -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()

Binary file not shown.

Before

Width:  |  Height:  |  Size: 316 B

After

Width:  |  Height:  |  Size: 345 B

BIN
assets/tiles/gf.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View file

@ -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

View file

@ -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, 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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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

View file

@ -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(