1 decade ago
by roger
Hi!
I have loaded some images in my game and I would like to rotate them.
Anyone knows how to rotate or flip an image?
Thanks!
I think that the current version of Impact (1.18a) only lets you rotate Entity instances, and indirectly so: just set their animation to the desired rotation angle, e.g.,
update: function()
{
this.currentAnim.angle = 45;
parent.update();
}
1 decade ago
by dominic
You can create Animation instances without having an Entity, so the easiest way to have rotations and flipping is to wrap your Image in an Animation.
If you don&039;t want to do that for whatever reason, look at the source for #lib/impact/animation.js
how it's done there and use the canvas methods directly.
note you have to specify x and y separately for flips
this.currentAnim.flip.x = true;
http://impactjs.com/documentation/class-reference/animation#flip-x-flip-y
Page 1 of 1
« first
« previous
next ›
last »