Sign in to follow this  

Game freezes after a seconds

Recommended Posts

rossanaguerra    100
Hi everyone, I am developing a single game with C++/SDL under Linux, just for render in 2D (I couldn't use openGL for hardware requeriments).
In its 1st phase it was just a sprite moving around, it worked.

I added screens, and the sprite. Each screen has it own file, the sprite movement it's in a spite sheet.
According I move backward/forward I change the screen or the sprite 'walk' through differents screen, jumps, etc.

I only once load the sprite file, the other ones, which contain the differents, screens (backgrounds) are loaded on demand (and I free them as well). I mean, if it's time to screen2, I do a SDL_FreeSurface(screen1) and then I load screen1.

It seems it's ok, but after a seconds the game gets stuck, it freezes.

What could be wrong?.

Thanks, and regards


Share this post

Link to post
Share on other sites
Bacterius    13165
[quote](you can do that in Linux, right?).[/quote]

OP: try and figure out where the problem is coming from first, by either breaking as Nypyren suggests or scatter some printf's around your code (ghetto debugging). Then you can usually either resolve the issue if it's a logic bug (infinite loop, condition never being satisfied, etc...), or if it's an error message from one of the API's you're using you can usually google it and find an answer, and ask here if nothing comes up. As it is now your question is much too general and we can't really give any specific help.

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