We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
Page Index Toggle Pages: 1
mirror image (Read 1681 times)
mirror image
May 11th, 2009, 9:28pm
 
hi, im new in processing and i'm looking to make a game but i have different images(cars) in the right direction, i need they to see in the other direction, how can i do this?  Huh

ps-> could be any function like image.mirror() or something like that?

thanks Wink
Re: mirror image
Reply #1 - May 11th, 2009, 10:05pm
 
There is a trick with scale that you could use.

It would probably be best used with pushMatrix() and popMatrix() for each image (or group of images) that you want to draw mirrored.

http://processing.org/reference/pushMatrix_.html
http://processing.org/reference/popMatrix_.html

Code:
//in draw()
//store scale,translation,etc
pushMatrix();

//flip across x axis
scale(-1,1);

//The x position is negative because we flipped
image(a, -x, y, a.width/2, a.height/2);

//restore previous translation,etc
popMatrix();
Re: mirror image
Reply #2 - May 11th, 2009, 10:28pm
 
it's working thank you  Grin
Page Index Toggle Pages: 1