| View previous topic :: View next topic |
| Author |
Message |
nDEV
Joined: 13 Apr 2007 Posts: 48
|
Posted: Sun Apr 15, 2007 12:14 am Post subject: My game crashes :/ |
|
|
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? |
|
| Back to top |
|
 |
nDEV
Joined: 13 Apr 2007 Posts: 48
|
Posted: Sun Apr 15, 2007 9:26 pm Post subject: |
|
|
| No one cant tell me how to locate the error? |
|
| Back to top |
|
 |
Jim

Joined: 02 Jul 2005 Posts: 487 Location: Sydney
|
|
| Back to top |
|
 |
nDEV
Joined: 13 Apr 2007 Posts: 48
|
Posted: Mon Apr 16, 2007 12:04 am Post subject: |
|
|
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];
| Quote: |
//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. |
|
| Back to top |
|
 |
nDEV
Joined: 13 Apr 2007 Posts: 48
|
Posted: Mon Apr 16, 2007 12:17 am Post subject: |
|
|
I found it!!!!!!!!!!!!!!!!!!!1111!
Never mind! |
|
| Back to top |
|
 |
J.F.
Joined: 22 Feb 2004 Posts: 2906
|
Posted: Mon Apr 16, 2007 4:44 am Post subject: |
|
|
| 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. :) |
|
| Back to top |
|
 |
|