From e0905512146c8d1b9e547395ff032b6fd1dd69ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20R=C3=BCmpelein?= Date: Thu, 25 Sep 2014 11:49:30 +0200 Subject: [PATCH] Self-Attacks now forbidden --- index.html | 2 ++ src/jsds_crafty.js | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index 4fd0ddc..32ee965 100644 --- a/index.html +++ b/index.html @@ -10,6 +10,8 @@
+
+
diff --git a/src/jsds_crafty.js b/src/jsds_crafty.js index fad6d0c..5bed572 100644 --- a/src/jsds_crafty.js +++ b/src/jsds_crafty.js @@ -78,7 +78,13 @@ this.enableControl(); }; if(e.mouseButton === Crafty.mouseButtons.RIGHT) { - cur_sel.attack(player[this.id]); + if ( !cur_sel ) { return; }; + if ( cur_sel == player[this.id]) + { + } + else { + cur_sel.attack(player[this.id]); + }; }; });