tiles
This commit is contained in:
parent
5d6c97d086
commit
3f590d507f
6 changed files with 75 additions and 1 deletions
|
@ -8,7 +8,8 @@ multilily = lily.loadMulti({
|
||||||
{lily.newImage, "assets/ships/blackstar-5.png"},
|
{lily.newImage, "assets/ships/blackstar-5.png"},
|
||||||
{lily.newImage, "assets/ships/excalibur-iv.png"},
|
{lily.newImage, "assets/ships/excalibur-iv.png"},
|
||||||
{lily.newImage, "assets/ships/decorator.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)
|
multilily:onComplete(function(_, lilies)
|
||||||
gameLogo = lilies[1][1]
|
gameLogo = lilies[1][1]
|
||||||
|
@ -22,6 +23,8 @@ multilily:onComplete(function(_, lilies)
|
||||||
CaptainJohn.ship.image = lilies[9][1]
|
CaptainJohn.ship.image = lilies[9][1]
|
||||||
boosterParticle = lilies[10][1]
|
boosterParticle = lilies[10][1]
|
||||||
|
|
||||||
|
tileGroundFull = lilies[11][1]
|
||||||
|
|
||||||
windowWidth = love.graphics.getWidth()
|
windowWidth = love.graphics.getWidth()
|
||||||
windowHeight = love.graphics.getHeight()
|
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
BIN
assets/tiles/gf.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
3
main.lua
3
main.lua
|
@ -39,6 +39,8 @@ function love.load()
|
||||||
require "ship/excaliburiv"
|
require "ship/excaliburiv"
|
||||||
require "ship/decorator"
|
require "ship/decorator"
|
||||||
|
|
||||||
|
require "planet/planet"
|
||||||
|
|
||||||
LoadScene = LoadScene()
|
LoadScene = LoadScene()
|
||||||
TitleScene = TitleScene()
|
TitleScene = TitleScene()
|
||||||
GameScene = GameScene()
|
GameScene = GameScene()
|
||||||
|
@ -48,6 +50,7 @@ function love.load()
|
||||||
|
|
||||||
currentScene = LoadScene;
|
currentScene = LoadScene;
|
||||||
currentPlayer = CaptainSteve;
|
currentPlayer = CaptainSteve;
|
||||||
|
currentPlanet = Planet()
|
||||||
|
|
||||||
require "assets"
|
require "assets"
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,10 +1,65 @@
|
||||||
Planet = Object.extend(Object)
|
Planet = Object.extend(Object)
|
||||||
|
|
||||||
function Planet:new()
|
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, 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, 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, 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
|
end
|
||||||
|
|
||||||
function Planet:update(dt)
|
function Planet:update(dt)
|
||||||
end
|
end
|
||||||
|
|
||||||
function Planet:draw()
|
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
|
end
|
||||||
|
|
|
@ -27,16 +27,29 @@ function GameScene:init()
|
||||||
1,1,1,0.4,
|
1,1,1,0.4,
|
||||||
1,1,1,0.3
|
1,1,1,0.3
|
||||||
)
|
)
|
||||||
|
|
||||||
|
currentPlanet:init()
|
||||||
|
currentPlanet:draw()
|
||||||
end
|
end
|
||||||
|
|
||||||
function GameScene:update(dt)
|
function GameScene:update(dt)
|
||||||
pSystem:update(dt)
|
pSystem:update(dt)
|
||||||
GameScene:updateInput(dt)
|
GameScene:updateInput(dt)
|
||||||
GameScene:updateBounds(dt)
|
GameScene:updateBounds(dt)
|
||||||
|
|
||||||
|
if currentPlanet ~= nil then
|
||||||
|
love.graphics.print("hebebs",100,100);
|
||||||
|
currentPlanet.update(dt)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function GameScene:draw()
|
function GameScene:draw()
|
||||||
love.graphics.setColor(255,255,255, 1)
|
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(pSystem, currentPlayer.px+2, currentPlayer.py)
|
love.graphics.draw(pSystem, currentPlayer.px+2, currentPlayer.py)
|
||||||
love.graphics.draw(
|
love.graphics.draw(
|
||||||
|
|
Loading…
Reference in a new issue