Mirroring Image

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
User avatar
Sparx
Party member
Posts: 125
Joined: Thu Apr 02, 2009 9:54 am
Location: Aachen, Germany

Mirroring Image

Post 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...
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Mirroring Image

Post 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.
User avatar
Sparx
Party member
Posts: 125
Joined: Thu Apr 02, 2009 9:54 am
Location: Aachen, Germany

Re: Mirroring Image

Post 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....
User avatar
mike
Administrator
Posts: 364
Joined: Mon Feb 04, 2008 5:24 pm

Re: Mirroring Image

Post 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.
Now posting IN STEREO (where available)
User avatar
Sardtok
Party member
Posts: 108
Joined: Thu Feb 21, 2008 2:37 pm
Location: Norway/Norge/諾威/挪威 (Yes, I'm teh back!)
Contact:

Re: Mirroring Image

Post 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.
Take off every Zigg for great rapist.
Now, outgay that!
User avatar
Sparx
Party member
Posts: 125
Joined: Thu Apr 02, 2009 9:54 am
Location: Aachen, Germany

Re: Mirroring Image

Post 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!!!
Post Reply

Who is online

Users browsing this forum: No registered users and 256 guests