Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- love.graphics.setDefaultFilter('nearest', 'nearest')
- require('libs/collision')
- local sceneManager = require('sceneManager/sceneManager'):new()
- function love.load()
- sceneManager:load()
- end
- function love.update(dt)
- sceneManager:update(dt)
- end
- function love.draw()
- sceneManager:draw()
- end
- local game = require('game/game')
- local playScene = {}
- function playScene:new()
- local obj = {
- game = game:new()
- }
- setmetatable(obj, self)
- self.__index = self
- return obj
- end
- function playScene:load()
- self.game:load()
- end
- function playScene:update(dt)
- self.game:update(dt)
- end
- function playScene:draw()
- self.game:draw()
- end
- return playScene
- local map = require('map/map')
- local player = require('player.player')
- local gui = require('gui/gui')
- local camera = require('libs/camera')
- local critter = require('entities/critter')
- local game = {}
- function game:new()
- local obj = {}
- setmetatable(obj, self)
- self.__index = self
- return obj
- end
- function game:load()
- self.map = map:new()
- self.map:load()
- addCurrentMap(self.map.currentMap)
- self.player = player:new()
- self.player:load()
- self.gui = gui:new(self.player)
- self.gui:load()
- self.critter = critter:new()
- self.critter:load()
- self.camera = camera:new(0, 0, nil, nil, 1)
- self.camera:load()
- self.camera:setTarget(self.player)
- print("Game loaded", self)
- print("Map loaded: ", self.map)
- print("Player loaded: ", self.player)
- print("GUI loaded: ", self.gui)
- print("Camera loaded: ", self.camera)
- end
- function game:update(dt)
- self.map:update(dt)
- self.player:update(dt)
- self.critter:update(dt)
- self.camera:update(dt)
- self.gui:update(dt)
- end
- function game:draw()
- self.camera:apply()
- self.map:draw()
- self.player:draw()
- self.critter:draw()
- self.gui:draw()
- self.camera:unset()
- end
- return game
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement