problem on sprites/image

1
2
3
4
5
6
	dbLoadImage("background.bmp", 1);
	dbCreateAnimatedSprite(2, "player0.bmp", 5, 2, 2);
	//Creating Sprites

	dbSprite(1,0,0,4);
	dbSprite(2, 200, 100,2);



my problem is, why is my player sprite behind the background sprite though i loaded and created the background first..

please someone check the code.. :(





full code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include "DarkGDK.h"
#include "player1.h"


int player_1 = 1;
int player_2 = 2;
int p1s = 5;
int p2s = 5;
void DarkGDK(void)
{
	//Configurations
	dbSyncOn();
	dbSyncRate(60);
	dbDisableEscapeKey();
	dbSetImageColorKey(95, 95, 95);
	//Loading Images
	
	dbLoadImage("background.bmp", 1);
	dbLoadImage("vertical wall.bmp", 2);
	dbLoadImage("horizontal wall.bmp", 3);
	dbCreateAnimatedSprite(99, "player0.bmp", 5, 2, 4);
	//Creating Sprites

	dbSprite(1,0,0,4);             //background
	dbSprite(99, 200, 100,4); //player
	dbSprite(3, 0, 0, 2);
	dbSprite(5, 0, 0, 3);
	dbSprite(6, 635, 0, 2);
	dbSprite(7, 0, 475, 3);

	while(LoopGDK())
	{
		if(dbEscapeKey() == 1)
		{
			break;
		}
		dbSync();
	}
	return;
}
Last edited on
You will likely need to look into the specs of DarkGDK to know if your doing things right. OpenGL requires a context creation with depth testing, and when you have depth testing it doesn't matter what order you draw in if the object is "dimensionally" behind the other object. Can you get other sprites to draw on top of the background image?

Personally I would recommend looking into using OpenGL directly, especially if all you want to do is 2D game development, it really isn't too much harder to learn how to use.
indeed i am planning to carry on OpenGL. Either on the 2 is ok for me.

but i am worried the OpenGL will only be compatible with ATI/AMD and NVIDIA drivers, my lappy is INTEL.

but for this problem i want it to be solved first >.>

my walls.bmp are on top of the background sprite(like i wanted it to), only the player sprite is doing wrong
Last edited on
Topic archived. No new replies allowed.