Skip to content

Commit 78236ef

Browse files
committed
put switchy at the bottom of the screen
1 parent d774d49 commit 78236ef

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/game/scenes/GameScene.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,9 @@ export class GameScene extends Phaser.Scene {
2424

2525
onAnalogReport = (event: AnalogReport) => {
2626
const { data } = event;
27-
const wKey = data.find((d) => d.key === AnalogKey.W)?.value ?? 0;
28-
const sKey = data.find((d) => d.key === AnalogKey.S)?.value ?? 0;
2927
const aKey = data.find((d) => d.key === AnalogKey.A)?.value ?? 0;
3028
const dKey = data.find((d) => d.key === AnalogKey.D)?.value ?? 0;
3129

32-
const vertical = sKey - wKey;
3330
const horizontal = dKey - aKey;
3431

3532
// The W key moves from center to the top of the screen
@@ -38,7 +35,7 @@ export class GameScene extends Phaser.Scene {
3835
// The D key moves from center to the right of the screen
3936
this.switchy.setPosition(
4037
this.cameras.main.width / 2 + (horizontal * this.cameras.main.width) / 2,
41-
this.cameras.main.height / 2 + (vertical * this.cameras.main.height) / 2
38+
this.cameras.main.height - 16
4239
);
4340
};
4441

@@ -76,7 +73,7 @@ export class GameScene extends Phaser.Scene {
7673
frameRate: 6,
7774
repeat: -1,
7875
});
79-
this.switchy = this.add.sprite(gameWidth / 2, gameHeight / 2, "switchy");
76+
this.switchy = this.add.sprite(gameWidth / 2, gameHeight - 16, "switchy");
8077
this.switchy.play("switchy-walk");
8178

8279
// Collision optimizations

0 commit comments

Comments
 (0)