View Full Version : How do I create a save game feature for a game ?
marvinkong
January 11th, 2005, 10:54 PM
I would wanna know how to create a save game feature available in a flash game . Do I need to use XML intergration or can I just use a txt ?
How do I make flash enter the variables instead of the player to create the save game himself by creating a text file ? (means that flash creates the txt or XML its self) .
And I would , too , wanna know how to make flash read the specific text file and load up the game according to the variables included in it . (Like , the time saved , amount of money in game , the items the players had acquired in game etc.)
Im not making a multiplayer game , I'm making a single player game instead . I hope you all could provide information regarding on this topic .
Im new here so please forgive me if I posted this on the wrong section .
Thanks in advance .
marvinkong
January 12th, 2005, 10:07 AM
*Bump*
Are there anyone here could help ?
RyxiaN
January 12th, 2005, 10:43 AM
No i need the same help
alzor
January 12th, 2005, 11:39 AM
I havent got a good answer for you, but it's going to be quite the proverbial B**ch doing that.
PCGamre
January 12th, 2005, 12:34 PM
This solution is kinda weak but it'll work pretty well (you could probably expand it). Also, it is not exactly as "smart" as you are asking for, but maybe this can give you ideas.... dunno.
At the end of each save point, you can give the user a code. Let's say "1" for level 1, "2" for level 2, etc etc.... Basically, for this example these would be the save passwords.
You could make 1 dynamic INPUT txtbox (for user to type in password) and another regular dynamic txtbox (for the msgbox to tell user if password is correct or not) on the title page of your game. Put it off stage and set focus to it. (or leave it on stage if you want people to see it). Prompt the user to type in the saved point password.
In button, you can put in something like:
on (release, keyPress "<ENTER>") {
// for password 1
if (saveGamecodebox=="1") {
msgbox="Go to level 1";
_root.score = 10000;
_root.health = 100;
// whatever else you wanna do
_root.fade1MC.play();
// for password 2
}else if (saveGamecodebox=="2") {
msgbox="Go to level 2";
_root.score = 20000;
_root.health = 100;
// whatever else you wanna do
_root.fade2MC.play();
} else {
msgbox="Incorrect Password";
}
}
pom
January 12th, 2005, 12:50 PM
The shared objects would be perfect for what you're trying to do (tute on the main site).
Otherwise, you'll have to use PHP :-/
Marz
January 12th, 2005, 11:46 PM
If it is an online style game... I'd just use PHP to make your life alot easier... Storing it in a database... However, if you can't... You can use the password feature above or like pom stated with shared objects...
Good Luck,
- MarZ -
benFusion
May 3rd, 2005, 02:55 PM
If there was a way for Flash to export to a TXT file that would work too, but I dont think that's possible, is it?
Edit: On looking at the Shared Object reference I think that's definately the best way to go:
http://www.kirupa.com/developer/actionscript/shared_objects.htm
so you could have multiple saved games (with different file names) and store whatever variables or items or money the character has in the game. Sounds like a winner... I should learn how to use that one, looks really useful :)
patricktheking
May 3rd, 2005, 07:55 PM
ya... how long variable last? till cookies cleared?
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.