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

1 decade ago by Jerczu

/><br />
<br />
You need to spawn this entity when you want to enable superpower or enable multiple depending on how many elements you want to float around your player. I use one as additional gun that fires at nearest target.<br />
<br />
<pre class= EntityPlayerSuperpower = ig.Entity.extend({ size:{x:20,y:20}, maxVel:{x:50,y:50}, type:ig.Entity.TYPE.NONE, checkAgainst: ig.Entity.TYPE.B, // Check Against B - our evil enemy group collides: ig.Entity.COLLIDES.PASSIVE, animSheet: new ig.AnimationSheet('media/entities/player/shell.png', 8, 4), angle:0, increase:0, parental:null, init: function(x,y,settings){ this.parent(x,y,settings); this.addAnim('idle', 5, [0]); //this.vel.x = (settings.flip ? -this.maxVel.x : this.maxVel.x); this.parental = settings.player; this.increase = Math.PI*2 ; }, update:function(x,y,settings){ //this.parent(); this.parental =[0]; x = (this.parental.pos.x+this.parental.size.x/2) +Math.cos( this.angle )*100; y = (this.parental.pos.y+this.parental.size.y/2) +Math.sin( this.angle )*100; this.pos.x = x; this.pos.y = y; this.currentAnim.angle = this.angle; //console.log(this.pos.x,this.parental.pos.x); //this.angle += this.increase; this.angle += 0.06; }, handleMovementTrace: function( res ) { this.parent( res ); }, // This function is called when this entity overlaps anonther entity of the // checkAgainst group. I.e. for this entity, all entities in the B group. check: function( other ) { other.receiveDamage( 115, this ); this.kill(); } });
As previous its wip so forgive bugs but elements do rotate around player in a circle no matter where your player is positioned.

1 decade ago by fugufish

pretty awesome!

1 decade ago by Jerczu

Cheers ;)

1 decade ago by bitmapshades

Cool! I didn't know it was possible to pass the settings object into the update function.
Page 1 of 1
« first « previous next › last »