How would you go about separating your intro,me...
Blitz3D Forums/Blitz3D Beginners Area/How would you go about separating your intro,me...
| ||
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? |
| ||
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. |
| ||
"Could be a reserverd word" As far as I know it is a legal Blitz command. |
| ||
Why make const? U could just do case "S_INTRO" ... do be able to do status = 1(S_INTRO) ? |
| ||
... 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 ; ; |
| ||
plus using constants ues less cpu |