A while ago I asked for help on the best solution for a tile based 2D game in another thread here and I have been trying around many different things since then.

However, there is a basic problem that I need to solve aswell, something that I am not sure on how to approach.

I have two sprites that are created in a level.
At positions vector(-100, 0, 0) and vector(100, 0, 0)
Simply: One is left and one is right, the Z is the same

Is it possible to have one Sprite always on top, no matter what the Z is? Layers, for example would be cool, but I did not find anything that worked.
The moving tree here, should always stay in front of the other one.

(The different Y's of the trees are just for making it more clear)

If I would change the Z,
then moving the camera causes a kind of "parallax scrolling" which I don't want.

Is there any solution for this?
Either layering the sprites somehow or
getting rid of the "parallax scrolling" when Z is different?

Yours Yking

Quote:

My test code:

///////////////////////////////
#include <acknex.h>
#include <default.c>

///////////////////////////////
function main()
{

video_window(NULL,NULL,NULL,"TEST");
vec_set(sky_color,vector(0,0,0));
level_load(NULL);
camera.pan = 90;
camera.tilt = 90;
camera.x = 0;
camera.y = 0;
camera.z = -700;
camera.ambient = 100;

ENTITY* sprite_a = ent_create("data/textures/sprites/test.tga", vector(-100, 0, 0), NULL);
sprite_a.tilt = -90;
sprite_a.pan = -90;


ENTITY* sprite_b = ent_create("data/textures/sprites/test.tga", vector(100, 0, 0), NULL);
sprite_b.tilt = -90;
sprite_b.pan = -90;


while(1)
{
//Movement
if (key_w == 1) {while(key_w ==1){wait(time_step*300);sprite_b.y -= 5; }}
if (key_s == 1) {while(key_s ==1){wait(time_step*300);sprite_b.y += 5; }}
if (key_a == 1) {while(key_a ==1){wait(time_step*300);sprite_b.x -= 5; }}
if (key_d == 1) {while(key_d ==1){wait(time_step*300);sprite_b.x += 5; }}
wait(1);
}


}