1 decade ago by Cadence96
Let's say I have a weapon entity with an offset.
And this is the init condition that defines the flip of my player entity.
If my player flips I want to change the offset of the weapon, I'm trying this way:
But my text editor shows me an error in that syntax.
This is how the code is moduled:
¿Does anyone know the syntax how to do change the offset when flipping? Or a better way than I am trying?
Thanks
PD: when I scroll to the bottom of the 'class-reference/entity page' the fixed menu stops scrolling and I can not see the complete list of entities.
My browser is Firefox, SO Windows 7.
http://impactjs.com/documentation/class-reference/entity
offset: {x:-65, y:2},
And this is the init condition that defines the flip of my player entity.
this.vel.x = this.accel.x = (settings.flip ? -this.maxVel.x : this.maxVel.x);
If my player flips I want to change the offset of the weapon, I'm trying this way:
this.vel.x = this.accel.x = (settings.flip ? -this.offset.x = 65 : this.offset.x = -65);
But my text editor shows me an error in that syntax.
This is how the code is moduled:
EntityBullet = ig.Entity.extend({ offset: {x:-65, y:2}, init: function( x, y, settings ){ this.parent( x + (settings.flip ? -4 : 8), y+8, settings ); this.vel.x = this.accel.x = (settings.flip ? -this.maxVel.x : this.maxVel.x); } })
¿Does anyone know the syntax how to do change the offset when flipping? Or a better way than I am trying?
Thanks
PD: when I scroll to the bottom of the 'class-reference/entity page' the fixed menu stops scrolling and I can not see the complete list of entities.
My browser is Firefox, SO Windows 7.
http://impactjs.com/documentation/class-reference/entity