   Simulate Z Axis in 2D
  [font=arial, sans-serif][size=2]Hi, I am working on a 2D image where I have X and Y axis now I want to simulate Z axis by scaling the size of objects in image. but I am stuck with the calculation. I don't know how to scale the objects based on Z-Axis. I red this http://en.wikipedia.org/wiki/Transformation_matrix link but didn't proof very helpful. Can anyone of you forward me to the right direction. I think I have successfully put my question on this email but if there is some thing missing please let me know . [/font]   
  why dont you just scale it down on the X and Y axis ?that way the image will be smaller.if you want it to be behind another sprite, then draw the backmost first and then move to the fonrt mostin other words the last sprite to be draw will be on 'top' and the first to be drawn will be on the 'bottom'   ;  I think he wants to know how to compute the scaling factor. Let D be the distance between the eye and the screen. The scaling factor is then D/(D+z). This is not hard to figure out with pen and paper (draw a diagram of the x/z plane and project an arbitrary point; you can find the formula using triangle similarity).   ;  It's basically:x' = c * x / zy' = c * y / zwhere c is a constant scaling factor (depending on the field of view).   ;  Alvaro !! Sorry for the basic question but how do I calculate D. I understand that this the distance between eye and screen but how do I calculate that ? Is this constant ? One place I tried using 1000 as D and it always return me wrong result. I was using the same formula u mention.Thanks for prompt response   ;  Hi darkchris !!!What should I put in c ? I understand this is a constant but u mention field view .... What is that ?   ;  Field Of View or FOV (in 3D atleast) is the angle of the sides of a triangle or its like defineing how wide you can see.try pictureing it as a 3D triangle and whith a greater FOV the greater the base of the triange is.get it ?i dont always explain things well.   ;Alvaro !! Sorry for the basic question but how do I calculate D. I understand that this the distance between eye and screen but how do I calculate that ? Is this constant ? One place I tried using 1000 as D and it always return me wrong result. I was using the same formula u mention.You can only calculate D if you know something else, like perhaps the horizontal angle of view and the width of the screen. Or you can just start setting D equal to the width of the screen and play with it until you like the results.   ;Hi darkchris !!!What should I put in c ? I understand this is a constant but u mention field view .... What is that ?You can calculate the scaling factor c using the intercept theorem. This is how the formula would look like with the field of view angle included:x' = x / (z * tan(fov_angle / 2))y' = x / (z * tan(fov_angle / 2))Note that the resulting coordinates will be in the range -1..1, so you might have to scale them.   