Self-Attacks now forbidden

This commit is contained in:
Oliver Rümpelein 2014-09-25 11:49:30 +02:00
parent a9c7f04230
commit e090551214
2 changed files with 9 additions and 1 deletions

View file

@ -10,6 +10,8 @@
<div id="game"></div> <div id="game"></div>
<button id="load">Load</button> <button id="load">Load</button>
<div id="output"></div> <div id="output"></div>
<div id="ui">
</div>
<script type="text/javascript" src="lib/crafty.js"></script> <script type="text/javascript" src="lib/crafty.js"></script>
<script type="text/javascript" src="lib/jquery-1.11.1.min.js"></script> <script type="text/javascript" src="lib/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="src/jsds_crafty.js"></script> <script type="text/javascript" src="src/jsds_crafty.js"></script>

View file

@ -78,8 +78,14 @@
this.enableControl(); this.enableControl();
}; };
if(e.mouseButton === Crafty.mouseButtons.RIGHT) { if(e.mouseButton === Crafty.mouseButtons.RIGHT) {
if ( !cur_sel ) { return; };
if ( cur_sel == player[this.id])
{
}
else {
cur_sel.attack(player[this.id]); cur_sel.attack(player[this.id]);
}; };
};
}); });
return this; return this;