Additional pop cleanup

This commit is contained in:
Ketchetwahmeegwun T. Southall 2022-01-30 05:02:38 -08:00
parent cdf74e2999
commit 117e261c35

View File

@ -1,6 +1,6 @@
import { ContextI } from "../ContextI"
import { segments } from "../shared/segments"
import { audio, playSong, disableSound, enableSound } from '../shared/audio'
import { audio, playSong, disableSound, enableSound, stopSong } from '../shared/audio'
import { StateI } from "./StateI"
import * as PIXI from 'pixi.js'
import * as planck from 'planck'
@ -209,6 +209,10 @@ export function GameState(ctx: ContextI, selectedAnimal: string, selectedSegment
for (let entity of entities) {
removeEntity(entity)
}
for (let zone of zones) {
removeZone(zone)
}
stopSong()
ctx.app.stage.removeChild(rootContainer)
}
let elapsed: number = 0
@ -375,6 +379,8 @@ export function GameState(ctx: ContextI, selectedAnimal: string, selectedSegment
desiredActions = adjustAction(desiredActions, 'south', 0)
} else if (e.key === 'z' || e.key === 'Control') {
desiredActions = adjustAction(desiredActions, 'attack', 0)
} else if (e.key === 'Escape') {
ctx.pop()
}
}
let keydown = (e: KeyboardEvent) => {