sonic-bluestreak/sonic-bluestreak.love/game/modules/playstyle/init.lua

58 lines
1.4 KiB
Lua
Raw Normal View History

2019-12-28 21:51:41 +01:00
Scene = require("core.modules.scenes")
local PlayStyle = Scene:extend()
local PauseMenu = require("game.modules.playstyle.pause")
local TestWorld = require("game.modules.world.parent")
function PlayStyle:new(playerNumber, cameraMode)
local playerNumber = playerNumber or 1
local cameraMode = cameraMode or "split"
PlayStyle.super.new(self)
self.timer = 0
self.assets:batchImport("game.modules.playstyle.assets")
PauseMenu(self)
self:initWorld()
end
function PlayStyle:initWorld()
TestWorld(self)
end
function PlayStyle:update(dt)
PlayStyle.super.update(self, dt)
if self.menusystem.menus["pauseMenu"].isActive == false then
self.timer = self.timer + dt
end
local keys = self:getKeys(1);
if keys["start"].isPressed then
if not (self.menusystem.menus["pauseMenu"].isActive) then
self.menusystem.menus["pauseMenu"].isActive = true
self.menusystem.menus["pauseMenu"].isVisible = true
self.menusystem.menus["pauseMenu"]:getFocus()
self.assets.isActive = false
self.world.isActive = false
else
self.menusystem.menus["pauseMenu"].isActive = false
self.menusystem.menus["pauseMenu"].isVisible = false
self.assets.isActive = true
self.world.isActive = true
end
end
end
function PlayStyle:restartLevel()
end
function PlayStyle:exitLevel()
scenes.title()
end
return PlayStyle