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.

DarkBASIC Discussion / returning to a menu screen

Author
Message
gazzamill
18
Years of Service
User Offline
Joined: 24th Dec 2007
Location:
Posted: 19th Jan 2008 00:52
probably a noob question - but i'm a bit of a DBC noob I have been reading through TDKs tuturials and using help in DB to try out some features.

I have a menu screen that loads, user clicks New game button , and the player goes to level 1, and can progress to level 2 when certain conditions are met. This all now works fine. I was wanting to save current position etc to file to load game (from the menu) at a later date.

The problem comes when the "q" button is pressed, the main menu should be displayed on screen until the user mouse clicks, but the menu only gets displayed very briefly then the program hangs.....

I know it sounds like a sycn and or loop issue, but i've tried different fixes with no success. I should also say that this project has evolved and is very much a work in progress, so the design was non existent!

I have attached the full source code (i think), as I'm not sure what may or may not be important.

any help gratefully received!

Sorry for the length of the post!
TDK
Retired Moderator
23
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 19th Jan 2008 02:26
Not looked at your code, but the problem you describe sounds like a common flag problem.

When you jump to your menu, you usually exit the Repeat..Until loop by setting a variable to 1 - ie when the player clicks the Play Game button.

When the problem you describe happens, the reason is usually that when the program returns back to the main menu, the variable hasn't been reset back to 0 before entering the loop - resulting in the loop (main menu) being exited before the user clicks on any buttons.

TDK_Man

gazzamill
18
Years of Service
User Offline
Joined: 24th Dec 2007
Location:
Posted: 19th Jan 2008 12:49
thanks for that, I had tried using a repeat until mouseclick(), but it didn't seem to help, but I will try again.

Btw TDK - thanks for all your tutorials, I have found them very useful, you obviously put a fair bit of time and effort into them, it is much appreciated

could someone tell me how to insert a "code snippet" in a post, rather than attach the whole file
Ortu
DBPro Master
18
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 21st Jan 2008 01:43
down at the bottom where you compose your message there is a box above the emoticons marked code

click that paste in your code and click the code again to close

TDK
Retired Moderator
23
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 21st Jan 2008 04:54
You can also paste the code in, highlight it with the mouse and then click on the code button - it adds the tags at the start and end of the code snippet.

Whichever floats your boat...

TDK_Man

gazzamill
18
Years of Service
User Offline
Joined: 24th Dec 2007
Location:
Posted: 21st Jan 2008 23:08
thanks for that.

I managed to sort out the menu problem, as I thought it was loops and sync causing problems. I have never used a language that needed so many nested loops before, but i assume it is becuase of the need to refresh the screen constantly. I will get there eventually

Login to post a reply

Server time is: 2026-07-06 00:08:30
Your offset time is: 2026-07-06 00:08:30