1 decade ago by Jerczu
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 = ig.game.getEntitiesByType(EntityPlayer)[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.
As previous its wip so forgive bugs but elements do rotate around player in a circle no matter where your player is positioned.