Hi!
I am making a 2D game (using Allegro and C++) and I have such a problem. In a typical game appear lots of different places. And if we are in a one place there is no need to keep in memory bitmaps, variables etc. which are necessery in the other one. And my question is how to make passages between different places and how to solve the problem with keeping in memory variables of different places.
As for now my only idea is to create a variable (let's call it place) which keeps the number of place and make in the main game loop something like this
while(game){
if(place==1){
//things happen in place number 1
}
else if(place==2){
//things happen in place number 2
}
... etc.
else if(place==){
}
}
But as I know my programming abilities there should be easier solution of my problem. Thanks very much in advance for any help.
PS. Sorry for my English but it's not my native language.
Comments