would it work if i typed in this:
Code: Select all
z = z + 5;
or
code: Select all
zvelocity = + 5;
i tried it once and it didn't work but is there a new way to do it?
A 2D Engine ( and indeed a 3D engine) has no real concept of Z... because the screen is 2 dimensional, the z axis is Faked.
in otherwords in a 2D world ( ie: a computer screen, there is no Z axis. what happens is , we use "tricks" to allow the human eye to think it is looking at 3D.
have you ever looked at a picture or photograph of a railway line dissapearring into the distance ? The paper it is on is only 2D.
example
- basic 3d with Crayolas (crayons) LOL
But because it has "perspective" and "disappears" our eyes believe it to be 3D (sort of)
so how to translate that to a game ?
well if you look closely at the example of the cube that BlarghNRawr posted, you will see that the "back" of the cube is simply on a higher "Y" point then the front. In otherwords we use the Y axis to "fake" the Z axis. which is why there is no command such as Z=Z-1;
BTW; this is where ZDepthing ( or Z buffering comes in..
if something is plotted on the Y axis to be further away then something else ( ie: deeper on the fake Z axis) then it should be drawn first, to ensure everything else "in front of it" , on the fake Z axis is drawn over the top, ie: things closer to you should obscure things further away.
note: if your "horizon" (or zero origin points) are within in the screen, things above the horizon should be on a lower Y axis ( think of that railway line picture,if the horizon is on the picture then clouds that are further away will be lower on the screen, not higher)
have a closer look at some of the 3d demos that have already been posted, and you should now get the idea of how it all works. The only thing left is to work out how "perspective" fits in to it all..
ie: the further away things are, the closer to each other they should appear and the smaller they should be ( think again of the railwayline image), there are many formulaes for this, and, for most games they are very simple.
Now, once you add the perspective the human eye really starts to see 3D,
so for a simple 3D game this is enough to work quite well... see one of my first examples... this is the "old school" way to do it and works quite well without complex math -
viewtopic.php?f=6&t=5431&p=37982&hilit=balls+of+fire#p37183The real difficulty is when you wish to "rotate" the scene around you .eg: wolfenstein (and I got that wrong so many times... LOL .) So, that will be another subject all together... you are best to try the basic 3D stuff first, until you get the hang of it.
In the mean time read up on basic "perspective" in drawings and art. ie: how artist paint pictures with depth.
hope that helps
oh... also there are a few other tricks you can add, because technically, things further way are also harder to see, so you can add blurryness to items the further away they get ( not easy in GE), they also tend to look slightly darker, which is a bit easier to do in GE using RGB or transparencies