Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Loading objects problem (menu system)

Author
Message
Ninja_Je5us
14
Years of Service
User Offline
Joined: 1st Feb 2010
Location:
Posted: 3rd Apr 2011 16:04
Hi all,

I am coming to the end of my project at university making a flying game using dark GDK and I am having some problems.

I have developed a menu system which includes a main menu, level selection menu and options menu.

This is all controlled using two enumerators. The first of these contains 4 levels, they are:

mainMenu,
optionsMenu,
levelSelectionMenu,
inGame;

The second is an enumerator with only 2 points, which is used to say which level the game is in, they are:

noLevel,
level1;

I should probably now explain that the second enumerator is called several times for each set of objects, (due to the nature of my classes). So that looks like this:



If I manually change each of these:


to this:


all of the objects load perfectly and the game works, however when it runs through the menu system to the same point, no objects load, I just get a blue screen but my timer and fuel usage work perfectly.

I have tested that the enumerators are hitting the right point by putting floats in that change value depending on the points and they hit the right point when they are supposed to.

I cant understand why my objects wont load, if anyone has any ideas of things I can check, please dont hesitate to reply.

I would post more code but I have nearly twenty classes and everything is all intertwined.

Regards
Matty H
16
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 3rd Apr 2011 16:37 Edited at: 3rd Apr 2011 16:37
Have you tried stepping through your code, keeping a watch on these variables:

g_levelSelection
g_levelUpdater
g_friendlyObjects
g_enemyObjects
g_neutralObjects

It sounds like your menu system is not working. Not sure what you mean by 'putting floats in' but steeping through the code might make things clearer?

Ninja_Je5us
14
Years of Service
User Offline
Joined: 1st Feb 2010
Location:
Posted: 3rd Apr 2011 17:30
Sorry I put in an if statement for each of the variables you mentioned above that were set to "1" if they were correctly set for the game to be playing.

And they all came up as "1", meaning the game should have been loaded up.
Para _Charlie
18
Years of Service
User Offline
Joined: 31st May 2006
Location: Wisconsin
Posted: 5th Apr 2011 04:26 Edited at: 5th Apr 2011 05:34
Is your enumerators set to a value or are they used the way we see them. Because the way they are setup at the moment, level1 is 1 and nolevel is 0.
#define nolevel 0
#define level1 1
is the way it used to be done.
Although enum is strictly c++ they still step their value per variable.
Could you be asking for a value that doesnt exist?
I'm just guessing with what I see.
enum levelSelection { noLevel = 0,
level1 = 1//or whatever
};

I've had this problem before. I kept trying to do a type convert from int to enum which turns out is completely illegal.

It may also be that your trying to change a constant.

Like 30 different TGC products. Cause I get bored easy.
Asus P5Q MB, P3.0 dual core, 8gigs ram, SATA HD, GTX 260
Win 7.
WLGfx
17
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 5th Apr 2011 14:57
For setting up your enum's I usually use a naming convention so I don't accidently mix variables up further down the line. Where you have level1 in your enum list you might be better off using something like this:



LS for Level Select. If is just another way to '#define' a list of values.

You might find that doing a global find and replace on those names you may have one somewhere you didn't expect.

Warning! May contain Nuts!
Mireben
16
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 5th Apr 2011 20:59
You should post more code, not everything but the skeleton of how the menu system works. Stepping through the code or setting breakpoints in the debugger can help too: check if the object loading commands are executed at all when you go through the menu system.

Login to post a reply

Server time is: 2024-11-19 12:20:42
Your offset time is: 2024-11-19 12:20:42