Reset reusable level state between room visits
This commit is contained in:
parent
4e0d0a6efe
commit
3889190e88
11
src/main.js
11
src/main.js
@ -1260,6 +1260,10 @@ class HouseScene extends Phaser.Scene {
|
|||||||
class PlayableLevelScene extends Phaser.Scene {
|
class PlayableLevelScene extends Phaser.Scene {
|
||||||
constructor(key) {
|
constructor(key) {
|
||||||
super(key)
|
super(key)
|
||||||
|
this.resetLevelRuntime()
|
||||||
|
}
|
||||||
|
|
||||||
|
resetLevelRuntime() {
|
||||||
this.playerDragging = false
|
this.playerDragging = false
|
||||||
this.playerDragTargetX = null
|
this.playerDragTargetX = null
|
||||||
this.lastDragX = null
|
this.lastDragX = null
|
||||||
@ -1475,6 +1479,7 @@ class RoomScene extends PlayableLevelScene {
|
|||||||
}
|
}
|
||||||
|
|
||||||
init(data) {
|
init(data) {
|
||||||
|
this.resetLevelRuntime()
|
||||||
this.roomId = data?.roomId ?? 'living'
|
this.roomId = data?.roomId ?? 'living'
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1565,6 +1570,10 @@ class RoofScene extends PlayableLevelScene {
|
|||||||
super('RoofScene')
|
super('RoofScene')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
init() {
|
||||||
|
this.resetLevelRuntime()
|
||||||
|
}
|
||||||
|
|
||||||
create() {
|
create() {
|
||||||
const worldWidth = 2900
|
const worldWidth = 2900
|
||||||
const groundY = 1370
|
const groundY = 1370
|
||||||
@ -1639,7 +1648,7 @@ const game = new Phaser.Game({
|
|||||||
})
|
})
|
||||||
|
|
||||||
window.__DOLLHOUSE__ = {
|
window.__DOLLHOUSE__ = {
|
||||||
version: '0.12.0',
|
version: '0.12.1',
|
||||||
game,
|
game,
|
||||||
async resetAll() {
|
async resetAll() {
|
||||||
await clearGameState()
|
await clearGameState()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user