Posted By
|
Message
|
Don Luciano Heavy combat pancake
Registered 25/10/2006
Points 380
|
8th November, 2010 at 16:55:25 -
I want to use a map editor for my flash game, not a map editor that is available for players, but just for me to make maps more easy than by doing frames and so on.
I don't know how would i add those ini files which would be maps, together with swf?
I know i can create ini in runtime, but it's empty until i fill it with stuff, but how would i go about adding a ini file thats already filled with data.
Code me a sausage!
|
UrbanMonk BRING BACK MITCH
Registered 07/07/2008
Points 49667
|
8th November, 2010 at 17:01:45 -
You can store the ini on a server and then use the GET object to retrieve it.
Drop the get request into a hidden string object and use the string parser to read from it.
This system would allow you to add new levels later.
To store them in the swf just add them to paragraphs of a hidden string object.
n/a
|
Don Luciano Heavy combat pancake
Registered 25/10/2006
Points 380
|
8th November, 2010 at 17:03:49 -
Yeah, but i would probably add the game to moochigames or something like that... ?
I mean would i be able to add ini file alongside my game?
Oh, you mean i could add the ini files to any server, and read them with get object, no matter where the game is?? Or not?
Can you elaborate a bit more on this, cause i have no idea how the string parser works.
Edited by Don Luciano
Code me a sausage!
|
UrbanMonk BRING BACK MITCH
Registered 07/07/2008
Points 49667
|
8th November, 2010 at 18:02:44 -
Yes, you'd put your levels on your server, and no matter where your game is it'll still connect to your server to get the map files.
Unless you made the map data internal using the sting method I described.
Really you don't have to use ini's at all. If you want you could store your level in whatever format you devise.
For parsing ini's you'll need to use list tokenizing, and actually I think the tokinizer object would be better for that.
But since I'm more familiar with the string parser I'll give you sudocode using it:
Start of Frame-
-Set the parsers string to your level string
-Add delimiter "="
-Add delimiter $newline
-Add delimiter "["
-Add delimiter "]"
Now if you have an ini like this:
[blah]
1=1,4
2=1,7
3=3,8
you should be able to retrieve the group name (as long as it's first in line) with:
GetElement$("String Parser 2", 1) = "blah"
And the other elements with:
GetElement$("String Parser 2", 2) = "1"
GetElement$("String Parser 2", 3) = "1,4"
and so on...
Of course you'll have to refine this for your purposes, but that's the basic idea.
Edited by UrbanMonk
n/a
|
Don Luciano Heavy combat pancake
Registered 25/10/2006
Points 380
|
8th November, 2010 at 18:43:24 -
Ah, great it worked, thanks.!
Edited by Don Luciano
Code me a sausage!
|
Don Luciano Heavy combat pancake
Registered 25/10/2006
Points 380
|
8th November, 2010 at 19:21:34 -
Or even better could i just transfer all the strings into the ini i create in runtime? And do the rest from there...
And that's what i did, so thanks you again very much.
Edited by Don Luciano
Code me a sausage!
|
Don Luciano Heavy combat pancake
Registered 25/10/2006
Points 380
|
8th November, 2010 at 21:58:03 -
Solved.
Edited by Don Luciano
Code me a sausage!
|
|
|