There's a pretty consitant way to structure game code, actually. Here's a template for a mini FPS, if you fill it in with code it should work.
`set up sync rate
sync on
sync rate 60
`load game
GAME LOADING CODE HERE
`main loop
do
`get player input
INPUT CODE HERE
`get monster AI
AI CODE HERE
`move bullets
BULLET MOVING CODE HERE
`check for bullet collision with player or monster
BULLET COLLISION CODE HERE
`check for player die
if playerhealth <= 0
`player dies
GAME OVER CODE HERE
endif
`check for monster die
if monsterhealth <= 0
`monster dies
WIN CODE HERE
endif
`update hud
HUD DRAWING CODE HERE
loop
But on bigger games, this tends to get messy, so you'll need to break everything up into functions. A lot more structure gets added then, because you load individual leves loading within the main loop and lots of systems working together (inventory handling, firing weapons, enemy AI, walking around, talking to people) It's a good idea to start with a template, otherwise putting all these systems together to make a game gets real messy.
Quote: "Gimme teh code!"
Thank you for not flooding the forums with posts like this.