From 814fde174eb5065e1f5c559913d964aa4e67517b Mon Sep 17 00:00:00 2001 From: -=yb4f310 Date: Tue, 13 Mar 2018 13:21:18 +0100 Subject: [PATCH] Update: CC - Snake FS - Key Up (306204wy29.js) 178 bytes modified --- 306204wy29.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/306204wy29.js b/306204wy29.js index 75db768..334326d 100644 --- a/306204wy29.js +++ b/306204wy29.js @@ -8,21 +8,33 @@ if (!this.initialized) { } if (data.keyCode === GameLib.System.Input.KEY_UP) { + if (this.direction.y === -1) { + return; + } this.direction.y = 1; this.direction.x = 0; } if (data.keyCode === GameLib.System.Input.KEY_DOWN) { + if (this.direction.y === 1) { + return; + } this.direction.y = -1; this.direction.x = 0; } if (data.keyCode === GameLib.System.Input.KEY_LEFT) { + if (this.direction.x === 1) { + return; + } this.direction.y = 0; this.direction.x = -1; } if (data.keyCode === GameLib.System.Input.KEY_RIGHT) { + if (this.direction.x === -1) { + return; + } this.direction.y = 0; this.direction.x = 1; }