now drawing the background and also put assets in global scope
This commit is contained in:
3
game.lua
3
game.lua
@@ -2,7 +2,6 @@
|
|||||||
-- The main game screen of Chuchu
|
-- The main game screen of Chuchu
|
||||||
Boipus = require('deps.boipushy')
|
Boipus = require('deps.boipushy')
|
||||||
Physics = require('deps.physics')
|
Physics = require('deps.physics')
|
||||||
assets = require('deps.cargo').init('data')
|
|
||||||
|
|
||||||
-- my own libs
|
-- my own libs
|
||||||
crates = require('crate')
|
crates = require('crate')
|
||||||
@@ -116,6 +115,8 @@ function Chu:update(dt)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function Chu:draw()
|
function Chu:draw()
|
||||||
|
love.graphics.setColor(255, 255, 255, 1)
|
||||||
|
love.graphics.draw(assets.sprites.level.background, self.x, self.y)
|
||||||
world:draw()
|
world:draw()
|
||||||
|
|
||||||
if self.debug then
|
if self.debug then
|
||||||
|
|||||||
16
main.lua
16
main.lua
@@ -3,6 +3,18 @@ DEBUG_MODE = true
|
|||||||
-- my own libs
|
-- my own libs
|
||||||
Chu = require 'game'
|
Chu = require 'game'
|
||||||
|
|
||||||
|
assets = require('deps.cargo').init({
|
||||||
|
dir = 'data',
|
||||||
|
loaders = {
|
||||||
|
png = love.graphics.newImage
|
||||||
|
}--[[,
|
||||||
|
processors = {
|
||||||
|
['images/'] = function(image, filename)
|
||||||
|
image:setFilter('nearest', 'nearest')
|
||||||
|
end
|
||||||
|
}]]--
|
||||||
|
})
|
||||||
|
|
||||||
local game = nil
|
local game = nil
|
||||||
|
|
||||||
function love.load()
|
function love.load()
|
||||||
@@ -21,3 +33,7 @@ function love.draw()
|
|||||||
|
|
||||||
if DEBUG_MODE then love.graphics.print('DEBUG MODE IS ENABLED', 850, 10) end
|
if DEBUG_MODE then love.graphics.print('DEBUG MODE IS ENABLED', 850, 10) end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
setmetatable(_G, {
|
||||||
|
__index = require('deps.cargo').init('/')
|
||||||
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user