1 decade ago by DaveVoyles
Does anyone know how I can rotate an image using Impact?
I'm not using animations for my bullets, so I can't use:
this.currentAnim.angle -= 3 * ig.system.tick;
My draw loop looks like this:
draw: function () {
ig.system.context.save();
ig.system.context.translate(this.pos.x - ig.game._rscreen.x, this.pos.y - ig.game._rscreen.y);
ig.system.context.drawImage(this.image.data, -this.offset.x, -this.offset.y);
ig.system.context.restore();
},
So what would I do to rotate the image from a fixed center point? ie - as the bullet is moving towards you, it's also spinning.
I'm not using animations for my bullets, so I can't use:
this.currentAnim.angle -= 3 * ig.system.tick;
My draw loop looks like this:
draw: function () {
ig.system.context.save();
ig.system.context.translate(this.pos.x - ig.game._rscreen.x, this.pos.y - ig.game._rscreen.y);
ig.system.context.drawImage(this.image.data, -this.offset.x, -this.offset.y);
ig.system.context.restore();
},
So what would I do to rotate the image from a fixed center point? ie - as the bullet is moving towards you, it's also spinning.