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 / menu screen lead to game issue

Author
Message
scuzz
14
Years of Service
User Offline
Joined: 27th Mar 2010
Location:
Posted: 22nd Jul 2010 19:30
hey,so i decided to add a titlescreen after i finished my game. I am using the

style to do this. but when i add this type of code to my game, the title screen shows up for only a flash before my actual game just starts playing. so i guess i have two questions: 1)how do i get the screen to not instantly disappear. 2) once the game goes to the "subroutine checkregion im not exactly show what to put in the "then" spot - do i use a "goto" to start up the main loop?

here is the actual game code. sorry its probably a complete mess.
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 22nd Jul 2010 19:54
There's no need to use GOTO at all or even GOSUB because you can make other DO/LOOPs and use EXIT to leave the DO/LOOP once they click in the right area.



EXIT works for all loops DO/LOOP, REPEAT/UNTIL, WHILE/ENDWHILE, even FOR/NEXT loops.

LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 22nd Jul 2010 19:57
I think this is what you are looking for, but am not sure:



So many games to code.......so little time.
scuzz
14
Years of Service
User Offline
Joined: 27th Mar 2010
Location:
Posted: 22nd Jul 2010 20:25
@ Grog Grueslayer that worked fine thanks.
@ LBFN that got the titlescreen to not instantly disappear, however, nothing happened when i clicked on the box that shouldve started the game.

I read a few tutorials that mentioned subroutines, but still a bit confused on when to use them/how
LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 22nd Jul 2010 20:41
My bad

Use this for your CheckRegion subroutine:



So many games to code.......so little time.
bitJericho
22
Years of Service
User Offline
Joined: 9th Oct 2002
Location: United States
Posted: 1st Aug 2010 19:50 Edited at: 1st Aug 2010 20:03
Quote: "I read a few tutorials that mentioned subroutines, but still a bit confused on when to use them/how "


You shouldn't really use subroutines or goto statements at all.

Use functions for most things. Use subroutines for advanced initialization things (since dbpro doesn't offer much better options for initializing things in included scripts). Use goto almost never, maybe, and only maybe, in escaping specific large if/then blocks for speed reasons.

Use subroutines and goto statements sparingly.

These are my personal techniques, and they've served me well. If you can get the job done, it doesn't matter a whole lot.

Login to post a reply

Server time is: 2024-11-16 15:41:49
Your offset time is: 2024-11-16 15:41:49