Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

1 decade ago by Jerczu

Useful if you have entities shooting at you or you want entity to disappear once it reached the edge of the screen. I am using it for projectiles in entity update function.

update:function(){
		this.parent();
		var pp = this.pos.x - ig.game.screen.x;
        if( pp > ig.system.width || pp<0){
			this.kill();
			//console.log("killed")
		}
	}

1 decade ago by stahlmanDesign

This helped figure out the problem with the NotificationManager drawing the message at the right spot.

http://impactjs.com/forums/code/notificationmanager-plugin

1 decade ago by Jerczu

Glad to be of help - I was searching for it on the forum and no one posted a snippet so when I figured it out I thought I'm ought to share it :)

1 decade ago by fulvio

You can use the following if you have no collision tiles at the bottom of your levels. Good for pitfalls.

var pp = this.pos.y - ig.game.screen.y;
if (pp > ig.system.height || pp < 0) {
   console.log('killed');
   this.kill();
}
Page 1 of 1
« first « previous next › last »