Ok for my game I would like to create a menu form which has a button called 'start game' which then links to the game form.
1) How do I create a new form hence a main menu for my game?
2) How do I link that form to another form?????
For instance if form1 is my gaming code and I create a new form called 'main menu' and add a button, how do I say after clicking start game on mainmenu form, it starts the game
Please need urgent help ):
Thanks
5 replies to this topic
#1
Posted 24 March 2011 - 12:33 PM
|
|
|
#2
Posted 24 March 2011 - 01:09 PM
You would need some way to reference the main form (game form) from the code in the menu form, so what I would do is alter the constructor for the menu form and create a parameter to pass in a form, which would be the main game form. When you declare your new menu form from the game code, pass in the game form as that parameter. Have your menu form store the game form in a class variable, and whenever you want to link back to the game code, just use that variable to call any of the public methods in your game form.
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
– Douglas Hofstadter, Gödel, Escher, Bach: An Eternal Golden Braid
#3
Posted 24 March 2011 - 03:40 PM
Thank you
But basically
When I select my project, create a new form called 'menu', make a button called start game, double click that button and type in the code
form1.show() 'form1 is the game form
The menu form doesn't pop up and show 'start game', it just goes straight into the game.... ):
Why is this happening?
Thanks
But basically
When I select my project, create a new form called 'menu', make a button called start game, double click that button and type in the code
form1.show() 'form1 is the game form
The menu form doesn't pop up and show 'start game', it just goes straight into the game.... ):
Why is this happening?
Thanks
#4
Posted 25 March 2011 - 06:15 AM
When you create a new project, the first form created is the one that launches by default. You can change this, or you can create a new project and create the menu form as the first form, then add a new form for the game form.
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
– Douglas Hofstadter, Gödel, Escher, Bach: An Eternal Golden Braid
#5
Posted 25 March 2011 - 06:01 PM
wow, I think you have identified my problem
How can I change the default form and make the new form my default form so I can link the new default form with the game or current one???
On the project window thingy on the right hand side my form has this arrow sign which I think is stopping me from linking forms because whenever I add a new form, add the code behind a button 'start' and run it, nothing happens and instead of mainmenu form appearing the game just starts....
Nonetheless how do I change my default form, please, please, please
Thank you!!!!!!!! You have definetly identified my problem
My CW is due in Monday and I g2g present it, this is my 1st year
KIND REGARDS
How can I change the default form and make the new form my default form so I can link the new default form with the game or current one???
On the project window thingy on the right hand side my form has this arrow sign which I think is stopping me from linking forms because whenever I add a new form, add the code behind a button 'start' and run it, nothing happens and instead of mainmenu form appearing the game just starts....
Nonetheless how do I change my default form, please, please, please
Thank you!!!!!!!! You have definetly identified my problem
My CW is due in Monday and I g2g present it, this is my 1st year
KIND REGARDS
#6
Posted 28 March 2011 - 05:45 AM
This link should tell you how to do this:
How to: Change the Startup Object for an Application (Visual Basic)
How to: Change the Startup Object for an Application (Visual Basic)
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
– Douglas Hofstadter, Gödel, Escher, Bach: An Eternal Golden Braid
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account


Back to top









