Question about separate game files, and making doors...

Non-platform specific questions.

Question about separate game files, and making doors...

Postby pizbi » Wed Jul 28, 2010 10:37 pm

When making my game I was going to make it where there was a map(but as a separate game data then the levels) and I wanted to make where each time you finish a level it goes to the map and unlocks a new level but every time it loads wouldn't everything in the map reset? so how would I make it so the map would unlock another level after finishing a level if they're 2 separate games? I alos wanted to know how to make doors were you push the up key or something and change location (but in the same game) without having to make each door a different actor (if possible) -
Attachments
Untitled.png
User avatar
pizbi
 
Posts: 37
Joined: Thu Jul 08, 2010 3:36 am
Location: oregon
Score: 7 Give a positive score

Re: Question about separate game files, and making doors...

Postby Game A Gogo » Thu Jul 29, 2010 1:18 am

There's two possible way to do this.
the first method would be using the SaveVars/LoadVars function with GE.
-Create a variable that will hold what level has been accomplished and make sure to place a save group
-at the end of the level, before loading the map,set your variable to the level number plus one (To say the next level will now be active), save your variables with saveVars("Filename",SaveGroup);
-On the map, make sure to create the exact same variable from your level file
-Make the level active depending on the variable and the level numbers, like with an if statement if(ActiveL>2)//Activate level2 script here

Note: This is like if it saves the game so the person can resume the game later when he loads the map file and the file containing the variable is present. To prevent this would be simply reseting the variable and saving it before exiting the map

the second method is more complex, which involves manually saving a file by creating a function to save/load files and set a variable. A longer detour
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

Re: Question about separate game files, and making doors...

Postby pizbi » Thu Jul 29, 2010 5:05 pm

Game A Gogo wrote:There's two possible way to do this.
the first method would be using the SaveVars/LoadVars function with GE.
-Create a variable that will hold what level has been accomplished and make sure to place a save group
-at the end of the level, before loading the map,set your variable to the level number plus one (To say the next level will now be active), save your variables with saveVars("Filename",SaveGroup);
-On the map, make sure to create the exact same variable from your level file
-Make the level active depending on the variable and the level numbers, like with an if statement if(ActiveL>2)//Activate level2 script here

Note: This is like if it saves the game so the person can resume the game later when he loads the map file and the file containing the variable is present. To prevent this would be simply reseting the variable and saving it before exiting the map

the second method is more complex, which involves manually saving a file by creating a function to save/load files and set a variable. A longer detour

oh, okay! now that gives me a better idea of what I can do! :)
User avatar
pizbi
 
Posts: 37
Joined: Thu Jul 08, 2010 3:36 am
Location: oregon
Score: 7 Give a positive score

Re: Question about separate game files, and making doors...

Postby Game A Gogo » Thu Jul 29, 2010 5:36 pm

if you stumble upon a problem along your way,don't hesitate to ask!
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron