Skip to content

Instantly share code, notes, and snippets.

@ysfzrn
Created October 2, 2017 07:38
Show Gist options
  • Save ysfzrn/89f6ba14587156363f45b2d91d81e7e3 to your computer and use it in GitHub Desktop.
Save ysfzrn/89f6ba14587156363f45b2d91d81e7e3 to your computer and use it in GitHub Desktop.
//src/stores/gameStore.js
...
class GameStore{
...
@action("restart handler")
handleRestart(){
NavigationStore.handleChangeRoute('gameScreen');
this.intervalRate = 5;
this.currentDirection = "right";
this.lastSegment = 10;
this.rightButtonText = "up";
this.leftButtonText = "down";
this.score = 0;
this.highScore = 0;
this.food = { x: 50, y: 50 };
this.snake = [
{ id: 1, x: 20, y: 0 },
{ id: 2, x: 10, y: 0 },
{ id: 3, x: 0, y: 0 }
];
}}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment