My game crashes :/

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
nDEV
Posts: 48
Joined: Fri Apr 13, 2007 1:26 am

My game crashes :/

Post by nDEV »

My game crashes after i complete the first level :/.

The code looks like this:

void nextlevel()
{
FREE_OBJECTS();
start_loading_next(level);//level = global variable : holds the current level
}

void gotonext_level()
{
if (LAST_OBJECT < 0) //out of the screen
{
level+=1;
nextlevel();
}

}
void game()
{
gotonext_level();
drawIMGS();
buttons();
collision();
}
int main ()

{

while(!osl_quit)
{
game();
}
clear();
}

Any ideas what's going on?
nDEV
Posts: 48
Joined: Fri Apr 13, 2007 1:26 am

Post by nDEV »

No one cant tell me how to locate the error?
User avatar
Jim
Posts: 476
Joined: Sat Jul 02, 2005 10:06 pm
Location: Sydney
Contact:

Post by Jim »

You haven't posted nearly enough information.
nDEV
Posts: 48
Joined: Fri Apr 13, 2007 1:26 am

Post by nDEV »

Ok , here's how i load the next level:

When its time to load the next level the program increases the value of the current level counter and calls the function like this:

counter+=1
loadLEVEL(counter);

load level function

First off all , im calling a function that releases all objects from memory. looks like this:

Note: IMAGE_ARRAY = OSL_IMAGE * IMAGE_ARRAY[128];
//clear array
for (int temp=0;temp<=arraysize;temp++) if ( IMAGE_ARRAY[temp] ) {
osldeleteimage(IMAGE_ARRAY[tem]);
}
//more code for background etc..
After all this , the program loads the new objects in the array.
And the game freezes...thats all.
nDEV
Posts: 48
Joined: Fri Apr 13, 2007 1:26 am

Post by nDEV »

I found it!!!!!!!!!!!!!!!!!!!1111!
Never mind!
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

Sometimes, all it takes is trying to explain the program to someone to debug it. You're going thru the code telling someone how it's SUPPOSED to work when you suddenly realize that snippet of code THERE doesn't match what you're telling the other folks. :)
Post Reply