Skip to content

Commit

Permalink
add query param to change scenes
Browse files Browse the repository at this point in the history
  • Loading branch information
thatkookooguy committed Sep 4, 2024
1 parent 316fa58 commit 5e80210
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import Phaser from 'phaser';

import KibibitLogoScene from './scenes/kibibit-logo.scene';
import ProfileScene from './scenes/profile.scene';

// select scene based on url params
const urlParams = new URLSearchParams(window.location.search);
const scene = urlParams.get('scene');

const config: Phaser.Types.Core.GameConfig = {
type: Phaser.AUTO,
Expand All @@ -10,10 +15,13 @@ const config: Phaser.Types.Core.GameConfig = {
physics: {
default: 'arcade',
arcade: {
gravity: { y: 200 }
gravity: { y: 500 }
}
},
scene: [ KibibitLogoScene ]
// scene: [ KibibitLogoScene ]
scene: [
scene === 'profile' ? ProfileScene : KibibitLogoScene
]
};

export default new Phaser.Game(config);

0 comments on commit 5e80210

Please sign in to comment.