Page 1 of 1

Mirroring Image

Posted: Mon Apr 06, 2009 8:45 pm
by Sparx
I want to mirror an image...
I know Scale -1.... but I',m rotating it arround different center, so i need to set the new rotation center for the mirrored image and the rotation point... but it's very hard to do since the negative scaling doesn't seem to work as i expected...

Re: Mirroring Image

Posted: Tue Apr 07, 2009 12:32 pm
by bartbes
It doesn't work as expected, or that's what I expect (:P). Anyway, rude knows the problem, so let's wait for 0.6.0.

Re: Mirroring Image

Posted: Tue Apr 07, 2009 1:11 pm
by Sparx
When is 0.6.0 released? I mean if that's in several month that would be waiting month before I can go on in gfx design....

Re: Mirroring Image

Posted: Tue Apr 07, 2009 6:56 pm
by mike
Sparx wrote:When is 0.6.0 released? I mean if that's in several month that would be waiting month before I can go on in gfx design....
Months. Many many months.

Re: Mirroring Image

Posted: Tue Apr 14, 2009 6:28 pm
by Sardtok
There's of course always the simple solution of making flipped graphics in the actual image files.
Not a good solution, but it gets the job done.

Re: Mirroring Image

Posted: Fri Apr 17, 2009 12:46 pm
by Sparx
I found an algorithm mirroring images with different center. Very strange functions i needed.. adjusted it by foot. I have a 1px error and it works with all 3 images I am using....

If this is the code of displaying the image "normall"

Code: Select all

MYIMAGE:setCenter(MYIMAGEROTATIONCENTERX,MYIMAGEROTATIONCENTERY)
love.graphics.draw(MYIMAGE, xpos-MYIMAGEToOverallCenterX, ypos-MYIMAGEToOverallCenterY, ANGLE, 1, 1)
Here the corresponding code for the mirrorred image

Code: Select all

MYIMAGE:setCenter(MYIMAGEROTATIONCENTERX+3*MYIMAGEToOverallCenterX+MYIMAGE:getWidth()-5,MYIMAGEROTATIONCENTERY)
love.graphics.draw(MYIMAGE, xpos+MYIMAGEToOverallCenterX-1, ypos-MYIMAGEToOverallCenterY, ANGLE, -1, 1)	
MYIMAGEToOverallCenter is the relative position to the players center. This makes absolutely no sense to me to integrate this in the set center function but NOTE: this is working for my Charakter in the game with all images i tested with +-1p... so close enough to use it...
If someone finds out the exact sollution PLEASE tell me!!!