1 decade ago by LaserBeam
Hi,
I am trying to switch between two entities that 1 player can control. However, everytime I do it the browser freezes.
swap: true, is defined in main. In EntityA in the update function is the following code:
##if(ig.game.swap){
this.kill();
ig.game.spawnEntity(EntityB, this.pos.x, this.pos.y, {flip:this.flip});
}
Any idea why the browser 'freezes'?
I am trying to switch between two entities that 1 player can control. However, everytime I do it the browser freezes.
swap: true, is defined in main. In EntityA in the update function is the following code:
##if(ig.game.swap){
if(ig.input.pressed('swap')){ig.game.swap=false;
this.kill();
ig.game.spawnEntity(EntityB, this.pos.x, this.pos.y, {flip:this.flip});
}
}
In EntityB the following code is defined in the update function: ##if(ig.game.swap==false){ ""if(ig.input.pressed('swap')){ ""ig.game.swap=true; this.kill(); ig.game.spawnEntity(EntityA, this.pos.x, this.pos.y, {flip:this.flip});"" } "" }
Any idea why the browser 'freezes'?