MCPcopy Create free account
hub / github.com/candybox2/candybox2.github.io / moveHorizontally

Method moveHorizontally

code/main/TheHole.ts:425–437  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

423 }
424
425 private moveHorizontally(): void{
426 var leftPressed: boolean = Keyboard.isKeyPressed("left");
427 var rightPressed: boolean = Keyboard.isKeyPressed("right");
428
429 if(leftPressed && !rightPressed){
430 this.getGame().getPlayer().move(new Pos(-1, 0));
431 this.isGoingRight = false;
432 }
433 else if(rightPressed && !leftPressed){
434 this.getGame().getPlayer().move(new Pos(1, 0));
435 this.isGoingRight = true;
436 }
437 }
438
439 private thePlayerWon(): boolean{
440 // If the player reached the bottom of the hole

Callers 1

updateMethod · 0.95

Calls 3

getPlayerMethod · 0.80
moveMethod · 0.45
getGameMethod · 0.45

Tested by

no test coverage detected