Page 1 of 1
Animation drawing?
Posted: Thu May 10, 2012 11:19 am
by Surgeon
Hey!
I've been trying löve for the past few days and I can't seem to find a way to draw an animation inverted in relation to the Yy axis. Do I have to have separate animations for left/right facing character?
Thanks!
Re: Animation drawing?
Posted: Thu May 10, 2012 12:08 pm
by Robin
Hi!
See
love.graphics.draw. If the fifth argument (sx) is negative, it is flipped horizontally, so you can do something like:
Code: Select all
love.graphics.draw(something.image, something.x, something.y, 0, something.dx < 0 and -1 or 1)
Hope that helps.
Re: Animation drawing?
Posted: Thu May 10, 2012 12:23 pm
by coffee
Surgeon wrote:Hey!
I've been trying löve for the past few days and I can't seem to find a way to draw an animation inverted in relation to the Yy axis. Do I have to have separate animations for left/right facing character?
Thanks!
Also too more things to what robin said. Remember that flipping the image isn't good if let's say you character isn't a symmetrical Image. if you have an sword in right hand flipping/inverting will show sword then in left hand.
Also remember that LOVE don't do image animation as default (like using a GIF). You will need to use some animation library or create a simple one of ours.
Re: Animation drawing?
Posted: Fri May 11, 2012 9:42 am
by juno
In relation to what coffee wrote..
If you have a character which is non symmetrical and is made up of >1 shapes, when it is flipped, the shape, body, fixtures dont flip with the image. Does anyone have a solution to this?