1 decade ago by paulh
I cant seem to workout the logic for this :-(
Im spawning entities of the sides of the screen and use:
The thing is i need, in some instances, to spawn entities beyond the location i want to kill them from .. so yes i could just extend the range so they have to be further off screen before killed but that will slow my game down so im hesitant.
I guess i need to have a "spawn state" whereby the player can still interact with them but they wont get killed as they spawn, any ideas?
Im spawning entities of the sides of the screen and use:
update: function() {
//console.log(this.pos.y);
//console.log(this.GravityFactor);
if (this.pos.x < - 40){ //kill if off left of screen
this.killcount();
this.kill();
}
if (this.pos.x > ig.system.realWidth + 40){ //kill if off right
this.killcount();
this.kill();
}
if (this.pos.y > 360){ //kill if below
this.killcount();
this.kill();
}
else if (this.pos.y < -50){ //kill if above
this.killcount();
this.kill();
}
this.parent();
},
The thing is i need, in some instances, to spawn entities beyond the location i want to kill them from .. so yes i could just extend the range so they have to be further off screen before killed but that will slow my game down so im hesitant.
I guess i need to have a "spawn state" whereby the player can still interact with them but they wont get killed as they spawn, any ideas?
