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.

Newcomers DBPro Corner / Variable problem

Author
Message
the destroyer
15
Years of Service
User Offline
Joined: 24th Dec 2008
Location:
Posted: 2nd Jul 2009 17:22
Hi, now its a new problem
everything works fine expect that when I'am in the game and press the escapepkey it does nothing, how do I make it so that when i press escapkey one time it shows menu and when I press it secend time it hides it



Thanx for the help
Robert The Robot
17
Years of Service
User Offline
Joined: 8th Jan 2007
Location: Fireball XL5
Posted: 2nd Jul 2009 18:06 Edited at: 2nd Jul 2009 18:09
It's a fairly simple If-statement you need - you're halfway there already. If I understand you correctly, you need to change:



to



and delete

from your View() function.

The reason you ran into difficulty is because the show_menu variable in your code is different to the show_menu in your view function - the second one is a local variable, that is created by the function and doesn't really exist outside it.

To get your original code working, you could just declare show_menu as a global variable at the top of your code, and you should be able to switch the menu on and off.

Oh, and one other thing - I'm not sure how clear camera view works (I'm a DBC user, don't really do much in DBPro) but if all it does ismake the screen go black, a better method for your view function would be:



The Do-Loop just allows you to draw your menu, paste images, whatever - this might be better, because as your code stands now, your game still runs in the background and the menu is displayed over these movements!

Hope this helps!

"I wish I was a spaceman, the fastest guy alive. I'd fly you round the universe, in Fireball XL5..."
the destroyer
15
Years of Service
User Offline
Joined: 24th Dec 2008
Location:
Posted: 3rd Jul 2009 00:38
thanx

Login to post a reply

Server time is: 2024-11-25 04:50:57
Your offset time is: 2024-11-25 04:50:57