DefaultScene > PlayScene

This commit is contained in:
KGrzeg 2021-10-17 15:34:09 +02:00
parent 05886cece5
commit 99b2462759
3 changed files with 7 additions and 7 deletions

View file

@ -1,4 +1,4 @@
import DefaultScene from '../scenes/DefaultScene' import PlayScene from '../scenes/PlayScene'
export default class DifficultyManager { export default class DifficultyManager {
readonly spawnInterval = 1500 //ms readonly spawnInterval = 1500 //ms
@ -6,14 +6,14 @@ export default class DifficultyManager {
readonly level = 30 readonly level = 30
readonly nextLevelRequirementIncrease = 10 readonly nextLevelRequirementIncrease = 10
private scene: DefaultScene private scene: PlayScene
private difficultyLevel = 1 private difficultyLevel = 1
private points = 0 private points = 0
private spawnAtOnce = 1 private spawnAtOnce = 1
private nextLevelRequirement = 10 private nextLevelRequirement = 10
constructor(scene: DefaultScene) { constructor(scene: PlayScene) {
this.scene = scene this.scene = scene
scene.events.on('asteroid:destroy', () => { scene.events.on('asteroid:destroy', () => {

View file

@ -1,6 +1,6 @@
import Phaser from 'phaser' import Phaser from 'phaser'
import DefaultScene from './scenes/DefaultScene' import PlayScene from './scenes/PlayScene'
const config: Phaser.Types.Core.GameConfig = { const config: Phaser.Types.Core.GameConfig = {
type: Phaser.AUTO, type: Phaser.AUTO,
@ -14,7 +14,7 @@ const config: Phaser.Types.Core.GameConfig = {
debug: false debug: false
} }
}, },
scene: [DefaultScene] scene: [PlayScene]
} }
export default new Phaser.Game(config) export default new Phaser.Game(config)

View file

@ -3,7 +3,7 @@ import Ship from '../classes/Ship'
import Asteroid from '../classes/Asteroid' import Asteroid from '../classes/Asteroid'
import DifficultyManager from '../classes/DifficultyManager' import DifficultyManager from '../classes/DifficultyManager'
export default class DefaultScene extends Phaser.Scene { export default class PlayScene extends Phaser.Scene {
readonly maxAsteroids = 70 readonly maxAsteroids = 70
player?: Ship player?: Ship
@ -17,7 +17,7 @@ export default class DefaultScene extends Phaser.Scene {
backgroundId = 0 backgroundId = 0
constructor() { constructor() {
super('default-scene') super('play-scene')
this.backgroundOrder = [] this.backgroundOrder = []
for (let i = 1; i < 10; ++i) for (let i = 1; i < 10; ++i)