How would you go about separating your intro,me...

Blitz3D Forums/Blitz3D Beginners Area/How would you go about separating your intro,me...

Apollonius(Posted 2004) [#1]
How would you go about BLOCKING (in blocks of codes) your Intro Screen, Your Menu which is after your intro...

Personnally I would do it like this:
global goto

Select goto
case "intro"
//stuff
case "menu"
//stuff
case "screen0"....

end select


Would this be a good idea to block code like that?
How would you do it? Would this be the best way?


semar(Posted 2004) [#2]
Basically yes. I would use constant instead of strings though, and I would eliminate the variable goto, because it could be a reserverd word.

An example of what I mean:
;constants for the status
const S_INTRO = 1
const S_MENU = 2
const S_FIRSTSCREEN = 3
const S_PLAYGAME = 4
const S_ENDGAME = 5

;the game status variable
global status

;test assignment
status = S_INTRO
.
.
select status
case S_INTRO
do_intro()
;
case S_MENU
do_menu()
;
case S_FIRSTSCREEN
do_firstscreen()
;
;
end select

function do_intro()
;
;show intro
end function
;
;

And so on. Each time the status changes, a different section (preferably a group of functions) of the program should be executed.

Hope this has sense for you,
Sergio.


eBusiness(Posted 2004) [#3]
"Could be a reserverd word" As far as I know it is a legal Blitz command.


Apollonius(Posted 2004) [#4]
Why make const?

U could just do

case "S_INTRO"

... do be able to do status = 1(S_INTRO) ?


Curtastic(Posted 2004) [#5]

... do be able to do status = 1(S_INTRO) ?


sometimes the states are in order, so to get to the next one you do status=status+1. it would be harder to do that with strings

but theres nothing wrong with this
;the game status variable
global status$

;test assignment
status = "intro"
.
.
select status
case "intro"
do_intro()
;
case "menu"
do_menu()
;
case "firstscreen"
do_firstscreen()
;
;
end select

function do_intro()
;
;show intro
end function
;
;



Agamer(Posted 2004) [#6]
plus using constants ues less cpu