From 1570889cdd0a801ee57cdbdfb4cd76a63c5ee1c6 Mon Sep 17 00:00:00 2001 From: -=yb4f310 Date: Tue, 13 Mar 2018 13:13:23 +0100 Subject: [PATCH] Update: CC - Snake FS - Key Up (306204wy29.js) 386 bytes modified --- 306204wy29.js | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/306204wy29.js b/306204wy29.js index 5f003b4..75db768 100644 --- a/306204wy29.js +++ b/306204wy29.js @@ -3,13 +3,31 @@ if (!this.entityLoaded) { } if (!this.initialized) { + this.direction = this.entityLoaded.direction; this.initialized = true; } if (data.keyCode === GameLib.System.Input.KEY_UP) { - console.log('key up'); + this.direction.y = 1; + this.direction.x = 0; } +if (data.keyCode === GameLib.System.Input.KEY_DOWN) { + this.direction.y = -1; + this.direction.x = 0; +} + +if (data.keyCode === GameLib.System.Input.KEY_LEFT) { + this.direction.y = 0; + this.direction.x = -1; +} + +if (data.keyCode === GameLib.System.Input.KEY_RIGHT) { + this.direction.y = 0; + this.direction.x = 1; +} + + console.log(data); //@ sourceURL=keyUp.js \ No newline at end of file