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 / How do i link a menu button to start the game?

Author
Message
Alvind
16
Years of Service
User Offline
Joined: 6th Dec 2007
Location: Northern Ireland
Posted: 7th Dec 2007 20:10
Im looking to link the 1st buttonmap to start the game.
I havent a baldy how to do it. Im using 1 of TDK's methods from his tut.


Set Display Mode 1024,768,32
Sync On: Sync Rate 60

Load Image "dai_menu.bmp",1
Paste Image 1,0,0
Set Text Opaque

Do
Mx=MouseX(): My=MouseY(): Mc=MouseClick()
If Mc=1 Then Gosub CheckRegion
Sync
Loop
End

CheckRegion:

If Mx > 317 and My > 241 And Mx < 723 And My < 307
Rem Add here, whatever code you want to be executed when you click button 1
Center Text 512,720,"Disabled"
Endif

If Mx > 317 and My > 338 And Mx < 723 And My < 405
Rem Add here, whatever code you want to be executed when you click button 2
Center Text 512,720,"Disabled"
Endif

If Mx > 317 and My > 435 And Mx < 723 And My < 502
Rem Add here, whatever code you want to be executed when you click button 3
Center Text 512,720,"Disabled"
Endif

If Mx > 317 and My > 531 And Mx < 723 And My < 599
Rem Add here, whatever code you want to be executed when you click button 4
Center Text 512,720,"Alvin Dewart 2007"
Endif
Rem Fifth Button
If Mx > 317 and My > 630 And Mx < 723 And My < 697
Rem Add here, whatever code you want to be executed when you click button 5
Center Text 512,720,"Exit"
End
Endif
Return

http://dai.moddb.com
HeavyAmp
18
Years of Service
User Offline
Joined: 25th Oct 2006
Location: Castle in the Sky!
Posted: 8th Dec 2007 05:48
Im not 100% certain on what you mean by link to the start of your game but I assume you mean go to it using gosub. I've added a gosub command to the first button for you. If this is not what you mean then please let me know. Also its a good Idea to use the code tags when you have a lot of code like that.



Better to be dead, than to live your life afraid.
Roxas
19
Years of Service
User Offline
Joined: 11th Nov 2005
Location: http://forum.thegamecreators.com
Posted: 8th Dec 2007 11:20
Tough you should use functions..


Click For Details!

Alvind
16
Years of Service
User Offline
Joined: 6th Dec 2007
Location: Northern Ireland
Posted: 8th Dec 2007 14:13
HeavyAmp thanks for your help, thats exactly what i was looking for! Hell im only trying to get my head around this stuff.

http://dai.moddb.com
HeavyAmp
18
Years of Service
User Offline
Joined: 25th Oct 2006
Location: Castle in the Sky!
Posted: 8th Dec 2007 17:40
Np, Roxas has a good point the sooner you learn functions the better. Your code will be more structured and easier to use.

Better to be dead, than to live your life afraid.

Login to post a reply

Server time is: 2024-11-25 09:23:15
Your offset time is: 2024-11-25 09:23:15