Advertisement Jump to content
Sign in to follow this  

Sprite problem?

This topic is 4964 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have a problem in which I cant display a second animation that I load for a sprite. I am using DirectX 8. The first part here says I am creating a sprite with two different animations.
void Entity::InitAnimations(IDirect3DDevice8* pD3Ddevice, Bitmap bitmap, D3DFORMAT format)
	animations = new Sprite[2]; 

	POINT start = {0,0};
	POINT end = {250,100};
	POINT dimensions = {50,50};



	start.x = 0; start.y = 100;
	end.x = 250; end.y = 150;
If I comment out the second bitmap.Load(...) function and try to display the IDLE animation I dont see anything. If I uncomment the second bitmap.Load(...) function the IDLE animation will be displayed. I should not have to reload the same bitmap image. I think the problem has something to do with the animations[RUNNING].Load() function. Here is what the animations[..].Load() function looks like.
void Sprite::Load(IDirect3DDevice8* pD3Ddevice, Bitmap bitmap,POINT start, POINT end, POINT dimensions, D3DFORMAT format)
	width = dimensions.x;
	height = dimensions.y;
	rows = (end.y-start.y)/height;
	columns = (end.x-start.x)/width;
	numbFrames = rows*columns;
	frame = 0;
	pTexture = new PDIRECT3DTEXTURE8[numbFrames];

	for(int row=0; row<rows; row++)
		for(int column=0; column<columns; column++)
			pD3Ddevice->CreateTexture(width,height,1,0,format,D3DPOOL_DEFAULT, &pTexture[frame]);

			position.x = start.x+(column*width);
			position.y = start.y+(row*height);

			RECT rcSrc;
			POINT ptDst = {0,0};

			frame ++;

	current_frame = 0;
Anybody see anything wrong?

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!