The timer i need help with is getting the Fireball that you just casted, to only cast once every so many seconds. Right now i have only been able to get it to animate as a flamethrower where the Fireball is casted continuously, and where its casted for a few seconds and then stops all together.
Here is the main code for spawning the Fireball:
Code: Select all
if(this.countdown = false){
this.cast.set(0.5);
this.countdown = true;
}
if(this.cast.delta() == 0){
if(this.countdown = true){
ig.game.spawnEntity( EntityBullet, this.pos.x + 60, this.pos.y + 40, {flip:this.flip} );
this.cast.reset();
}
}
else{
this.countdown = false;//conditions met reset the trigger to allow this action be triggered again
}