Quote: "Or should you have one file that pretty much decodes everything and try to control everything by logic statements and variables ?"
Quote: "plus with having one agc file that detects all of my conditions it was getting harder to get all of the logic correct. So I re-did some of my code and it is getting more manageable."
The best way to go about this is to use what's known as a
"State Machine", you set states for various parts of your game and this enables you to compartmentalize your game logic, 2 good examples in the thread I linked to but I'll break it down a bit here
so your main loop would look a little like this, you only process the code that responds to the level you are playing, all you need to change is the value of "gGameLevel" all need for other logic is removed
Global gGameLevel
#Constant LEVEL_MENU 1
#Constant LEVEL_1 2
#Constant LEVEL_2 3
#Constant LEVEL_3 4
#Constant LEVEL_4 5
#Constant LEVEL_5 6
Select gGameLevel
Case LEVEL_MENU
EndCase
Case LEVEL_1
EndCase
Case LEVEL_2
EndCase
Case LEVEL_3
EndCase
Case LEVEL_4
EndCase
Case LEVEL_5
EndCase
EndSelect
so say you have a function "ProcessCollisions()" that handle your player collisions and its becoming a mess not knowing what code is for what level, you break it down into states, a default state that would handle common collisions with walls, floors and such and level dependant code specific for each level in its own state
building your entire game like this with multiple "State Machines" can really help reduce the confusing logic load, combine it with a function for each state and you see you can have the collision logic or other logic for the entire game within a single file and understand exactly where you need to be editing and not a "if" statement in sight (yet)
Function CollisionDefault()
EndFunction
Function CollisionLevel_1()
EndFunction
Function CollisionLevel_2()
EndFunction
Function CollisionLevel_3()
EndFunction
Function CollisionLevel_4()
EndFunction
Function CollisionLevel_5()
EndFunction
Function ProcessCollisions(GameState)
Select GameState
Case LEVEL_1
// collision logic for level 1
CollisionDefault()
CollisionLevel_1()
EndCase
Case LEVEL_2
// collision logic for level 1
CollisionDefault()
CollisionLevel_2()
EndCase
Case LEVEL_3
// collision logic for level 1
CollisionDefault()
CollisionLevel_3()
EndCase
Case LEVEL_4
// collision logic for level 1
CollisionDefault()
CollisionLevel_4()
EndCase
Case LEVEL_5
// collision logic for level 1
CollisionDefault()
CollisionLevel_5()
EndCase
EndSelect
EndFunction
and your main loop is simply calling "ProcessCollisions(gGameState)" or in your main loop state machine
do
Select gGameState
Case LEVEL_MENU
// process code for the menu
EndCase
Case LEVEL_1
// process logic for level 1
ProcessCollisions(LEVEL_1)
EndCase
Case LEVEL_2
// process logic for level 2
ProcessCollisions(LEVEL_2)
EndCase
// ETC ETC
EndSelect
Sync()
loop
Hope that made some sense