how can i improve this game structure?
Blitz3D Forums/Blitz3D Beginners Area/how can i improve this game structure?
| ||
| hi... i need an advice for the new game structure.. game style : Race car game the program structure is like this..
.menu
clearworld()
while
if race_start then gosub race
menu loop
wend
end
.race
clearworld()
load ode world and ode things
while (race)
race loop
wend
destroy ode things
gosub menu
this is a good structure for the game? |
| ||
| Using GoSub in a 'good structure' is an oxymoron. ;) |
| ||
| :) how can i aboid to use gosubs? |
| ||
| Use functions instead. |
| ||
| A game state system would be better IMO. Something like
Select GameState
Case GAMESTATE_MENU
clearworld()
while
if race_start then State=GAMESTATE_RACE
menu loop
wend
Case GAMESTATE_RACE
clearworld()
load ode world and ode things
while (race)
race loop
wend
destroy ode things
GameState=GAMESTATE_RACE
End Select
|
| ||
| Thanks Gabriel! :) |
| ||
| Yeah, break it down further in each function, so it's simplier to keep track of your game. |