File tree Expand file tree Collapse file tree 1 file changed +2
-5
lines changed
Expand file tree Collapse file tree 1 file changed +2
-5
lines changed Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments