Sign in to follow this  
russt17

giving an SDL surface NULL co-ordinates

Recommended Posts

Hi, I'm making a simple game with enemies that you can kill by shooting them. Currently, I have it set up so that when an enemy dies, it's SDL surface's cooridinates are changed to x = 1000 and y = 1000 so that they are not visible on the screen, and I have it so that they aren't being blitted anymore. Is there a way that instead of just moving the enemy's surface I can get rid of the surface entirely once the enemy dies? I'll still have to reuse the surface on the next level of the game, but just right when its killed is there a way to temporarily get rid of the surface just to make the game not have so many loaded surfaces? Thanks!

Share this post


Link to post
Share on other sites
If your enemies all look the same (or even if they didn't really) you only need 1 surface for them. You can blit that same surface in many places. SDL has functions that accept source rectangles as parameters for blitting only a section of a surface to another surface.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this