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?
My game crashes :/
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];
And the game freezes...thats all.
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];
After all this , the program loads the new objects in the array.//clear array
for (int temp=0;temp<=arraysize;temp++) if ( IMAGE_ARRAY[temp] ) {
osldeleteimage(IMAGE_ARRAY[tem]);
}
//more code for background etc..
And the game freezes...thats all.