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 / help with connecting menu to game =/

Author
Message
python89
18
Years of Service
User Offline
Joined: 15th Nov 2006
Location:
Posted: 15th Nov 2006 18:37
hi
me and my buddys have a school task, where we are going to create a couple of games, but none of understand how we should make the menu work, like if i press spacekey on play, the game should begin, can someone help me out with the code?

here is the menu code


and here is the entire code for the game


so if anyone could help me out with this so thanks

p.s. sry about my bad english XD
UFO
19
Years of Service
User Offline
Joined: 11th Oct 2005
Location:
Posted: 15th Nov 2006 20:59
Here:

All it does is it loops until you press the space key and then it continues, so you have to add the other menu stuff you have in your menu code to this.



Code Dragon
18
Years of Service
User Offline
Joined: 21st Aug 2006
Location: Everywhere
Posted: 16th Nov 2006 01:06 Edited at: 16th Nov 2006 01:07
You can put the game code in a function and make the menu call that function. I have more info on how to do this properly my Pac-Man tutorial, just follow the link in my signature.

[edit]

It's in Tutorial 3, if you're in a hurry.

Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 16th Nov 2006 01:41 Edited at: 16th Nov 2006 01:43
I assume that selection 1 is "Play" and selection 2 is "Quit". If that's the case all you need after UFOs code is:





When I make 2D menus I make one image the way the entire menu looks without highlighting the text. The highlighted text images are loaded and made into sprites at exactly the position they are on the background image and the sprites are hidden. The currently selected text only unhides that sprite. When the other menu option(s) are selected the current selected sprite is rehidden and the new selection is unhidden.

It still looks the same but the code would probably look more impressive to the teacher.

Edit: Thank you for telling us this is a school assignment. I burns me up when kids try to get us to do their homework for them without telling us it's a homework assignment.

Login to post a reply

Server time is: 2024-11-26 08:46:56
Your offset time is: 2024-11-26 08:46:56