fix: don't jump at minigame start

This commit is contained in:
Kazhnuz 2020-08-16 11:03:06 +02:00
parent 70ed18202d
commit e8e5ba9a76
3 changed files with 13 additions and 3 deletions

View file

@ -18,7 +18,7 @@ function PlayStyle:new(supportedLevels, missionfile)
self:initMission() self:initMission()
self:initCharacters() self:initCharacters()
self:startLevel() self.haveStarted = false
end end
function PlayStyle:loadMissionFile(supportedLevels, missionfile) function PlayStyle:loadMissionFile(supportedLevels, missionfile)
@ -44,7 +44,15 @@ function PlayStyle:getCharacterName(charID)
end end
function PlayStyle:update(dt) function PlayStyle:update(dt)
if (self.haveStarted) then
PlayStyle.super.update(self, dt) PlayStyle.super.update(self, dt)
self:updatePauseMenus(dt)
else
self:startLevel()
end
end
function PlayStyle:updatePauseMenus(dt)
if self.menusystem.menus["pauseMenu"].isActive == false then if self.menusystem.menus["pauseMenu"].isActive == false then
self.timer = self.timer + dt self.timer = self.timer + dt
end end
@ -68,6 +76,7 @@ function PlayStyle:update(dt)
end end
function PlayStyle:startLevel() function PlayStyle:startLevel()
self.haveStarted = true
self.world:loadMap() self.world:loadMap()
--self.assets:playMusic() --self.assets:playMusic()
end end

View file

@ -31,7 +31,7 @@ function Player:updateStart(dt)
self:basicMovements() self:basicMovements()
if self.keys["A"].isDown and (self.onGround) then if self.keys["A"].isPressed and (self.onGround) then
self.zsp = 280*1.33 self.zsp = 280*1.33
end end

View file

@ -72,6 +72,7 @@ function menu.SceneWidget:new(scene, menuName, newScene, newSceneName, sceneArgu
end end
function menu.SceneWidget:action() function menu.SceneWidget:action()
self.scene:flushKeys()
if (self.sceneArgument ~= nil) then if (self.sceneArgument ~= nil) then
self.newScene(self.sceneArgument) self.newScene(self.sceneArgument)
else else