Self-Attacks now forbidden
This commit is contained in:
parent
a9c7f04230
commit
e090551214
2 changed files with 9 additions and 1 deletions
|
@ -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>
|
||||
|
|
|
@ -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]);
|
||||
};
|
||||
};
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue