Animation question

I am attempting to create a shooter game for my son. It is a small shooter
where the user controls a crosshair on the screen and shots cans and
bottles off a fence. My problem is that the crosshair is leaving trails
all over the screen. I am posting a code snippet below from my event
loop. Any help in resolving this is greatly appreciated.

tmpRect.x = crosshairs.cur_x;
tmpRect.y = crosshairs.cur_y;
tmpRect.h = 32;
tmpRect.w = 32;
SDL_BlitSurface(screen, &tmpRect, tmpBack, NULL);

    // move code and start of event loop

	case SDL_MOUSEMOTION:
		SDL_BlitSurface(tmpBack, NULL, screen, &tmpRect); 
		
		tmpRect.x = event.motion.x;
		tmpRect.y = event.motion.y;
		tmpRect.h = crosshairs.image->h;
		tmpRect.w = crosshairs.image->w;
		SDL_BlitSurface(screen, &tmpRect, tmpBack, NULL);

		crosshairs.cur_x = event.motion.x;	
		crosshairs.cur_y = event.motion.y;
		src.x = 0;		dest.x = crosshairs.cur_x;
		src.y = 0;		dest.y = crosshairs.cur_y;
		src.w = crosshairs.image->w;	
                    dest.w = crosshairs.image->w;
		src.h = crosshairs.image->h;	
                    dest.h = crosshairs.image->h;
		SDL_BlitSurface(crosshairs.image, &src, screen, 

&dest);
break;

Thanks in advance,
Jason

I am attempting to create a shooter game for my son. It is a small shooter
where the user controls a crosshair on the screen and shots cans and
bottles off a fence. My problem is that the crosshair is leaving trails
all over the screen. I am posting a code snippet below from my event
loop. Any help in resolving this is greatly appreciated.

Um… well, this might be painfully stupid on my part, but are you erasing
the old position before drawing the new one?

–>Neil-------------------------------------------------------------------------------
Neil Bradley In the land of the blind, the one eyed man is not
Synthcom Systems, Inc. king - he’s a prisoner.
ICQ #29402898

My attentions are to blit the background to a surface and then blit the
crosshair to the screen. Once the mouse is moved, I would replace the
background here the crosshair was, then blit the crosshair at the new
location. I think that I may have my blits messed up though.

Jason>> I am attempting to create a shooter game for my son. It is a small

shooter where the user controls a crosshair on the screen and shots
cans and bottles off a fence. My problem is that the crosshair is
leaving trails all over the screen. I am posting a code snippet below
from my event loop. Any help in resolving this is greatly
appreciated.

Um… well, this might be painfully stupid on my part, but are you
erasing the old position before drawing the new one?

–>Neil



Neil Bradley In the land of the blind, the one eyed man is
not Synthcom Systems, Inc. king - he’s a prisoner.
ICQ #29402898


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl