Commits

Shu Zong Chen committed 1d890b4

we now have pausing

Comments (0)

Files changed (1)

public_html/static/js/main.js

 			this.snake.emote('dead');
 			this.snake.render();
 			this.sounds.play('crash');
-			this.hud.show_message(["YOU SHOULD AVOID THINGS", "(THINGS THAT YOU CAN'T", "EAT THAT IS)"]);
-			this.grid.add(this.snake);
-			this.snake.reset();
+
+			this.hud.lock_screen();
+			window.setTimeout(lang.hitch(this, function(){
+				this.hud.unlock_screen();
+				this.hud.show_message(["YOU SHOULD AVOID THINGS", "(THINGS THAT YOU CAN'T", "EAT THAT IS)"]);
+				this.grid.add(this.snake);
+				this.snake.reset();
+			}), 2000);
 		},
 		hooray: function(){
 			this.grid.add(this.snake);
 		render: function(){
 			html.set(this.high_score, "SCORE:" + this.score + " LIVES:" + this.lives);
 		},
+		lock_screen: function(){
+			this.engine.pause();
+			this.locked = true;
+		},
+		unlock_screen: function(){
+			this.locked = false;
+		},
 		show_message: function(text, modal){
 			if (_.isUndefined(modal)){
 				modal = true;