File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed
Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ export interface PlayerInput {
77 hold : string ;
88}
99export const inputs = {
10+ pause : "p" ,
1011 player1 : {
1112 left : "a" ,
1213 right : "d" ,
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ import GatePiece from "./GatePiece";
1717import { type Level } from "../levels" ;
1818import GameNode from "./GameNode" ;
1919import { animate } from "motion" ;
20- import type { PlayerInput } from "../inputs" ;
20+ import { inputs , type PlayerInput } from "../inputs" ;
2121import { pulse } from "../animations" ;
2222import { delay } from "../util" ;
2323import { playSound } from "../audio" ;
@@ -287,6 +287,14 @@ export default class Player extends GameNode {
287287 } ;
288288
289289 onPress = ( key : string ) => {
290+ if ( key === inputs . pause ) {
291+ if ( this . currentState === "game" ) {
292+ this . currentState = "pause" ;
293+ } else {
294+ this . currentState = "game" ;
295+ }
296+ return ;
297+ }
290298 if ( this . currentState !== "game" ) {
291299 return ;
292300 }
You can’t perform that action at this time.
0 commit comments