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>
<button id="load">Load</button>
<div id="output"></div>
<div id="ui">
</div>
<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="src/jsds_crafty.js"></script>

View file

@ -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]);
};
};
});