Great Level Editor Using List Object
Author: | J.J
|
Submitted: | 1st October, 2004
|
Views: | 5478
| Rated: |
|
|
---Making A Level Editor Using List Object---
This is my first article. Im sorry if it turns out bad but im pretty sure its a good one if you want to know how to make a level edit.r
And one thing before we start: Using Arrays whould maybe be better for security. The list will not be encrypted.
First, this article demands basic knowledge of String Parser 2. I will not explain its functions.
This is not the solution to a perfect level editor either.
This might even not work fully. But i've done this my self and it worked perfect. So if you understand what i mean with all this it might turn out good.
acctually making a level editor is really simple. I know you deont belive me yet, but let me convince you!
You need a list object & string parser 2.
For string parser you add the delimiter : "|"
This is the "thing" that should split up each line in the list so it can be understood by the level editor. Let me explain a bit more detailed.
Part 1 - Dummy Objects
First you make a 'place object' engine.
Create a active object and rename it to Block.
Make to frames in it. One for a black block and one for a blue one.
For the first object (Black Block)
-When user presses xxxx mouse button
>Global Value A = 1 //This is the value wich decides wich object to create.
+Create Block 1 at (Somwhere outside screen).
+Set Block possision to xmouse & ymouse.
+Set animation frame 1
For the second (Blue Block)
-When user presses xxxx mouse button
>Global Value A = 2 //This is the value wich decides wich object to create.
+Create Block 1 at (Somwhere outside screen).
+Set Block possision to xmouse & ymouse.
+Set animation frame 2
Also you must create some way to change between the two objects.
Simple enough. This just makes some dummy objects for us to play with.
Part 2
Makes sure you have made a delimiter for the Parser object.
I will use "|". Ok, firs we must make a way to save the objects possision and type (Black Block or Blue Block).
Then we need to have a save loop wich saves the possision, removes the objects and save the list file.
-Uppon pressing A (Save button for now)
+Star Loop 'Save'. Run this loop as many times that there are active objects.
This will start the save loop.
-On Loop 'Save'
>Pick Active at random
+Add to list: "&&&" + ActiveX + "|" + ActiveY + "|" + ActiveFrame
+Remove Active Object.
+Save the list file somwhere....
This will fill out the list with
&&&|345|342|0
or
&&&|200|430|1
The first &&& is so the load loop knows that the current line is about creating a level object. For example if your level file should hold other data than those above you can use for example:
???|LevelName|MyLevel
Then when the load loop runs it will know that this is not a create object line but somthing else.
Anyway:
&&&|345|342|0
&&& : What type of line this is.
345 : X posission.
342 : Y Possision.
0 : Object type. In this case blue og black block.
Ok, thats it for now. This will make a long list with possision and type of all objects you created on the level.
Part3
Now we need to load this shit into the level.
-Uppon pressing B (The load button for now)
+Open a list file. (The one you created)
+Start loop load. Run this loop (total number of lines in the list) times.
This event will first load the file you saved. Then start a loop wich will loop a x number of times. Depends on how many lines the list you loaded have.
-On Loop 'Load'
+Set current line to list select +1
+Set source string to current line.
This will set the current line to the next one.
And set the source string in the strin parser to the current line.
Then you can load the objects into the level by having this event:
-On Loop 'Load'
>Get Element 1 (String Parser) = $$$
+Create Active (Somwhere outside screen)'
+Set X possision to (element 2 (String Parser))
+Set Y possision to (element 3 (String Parser))
+Force animation to frame (Element 4 (String Parser))
+Set source string to current list line
Hopefully this will be enough to load the level.
Part 4
Adding additional information into the list/level.
As i told you $$$ meant that there was information to
create a object on the screen.
and ??? contained information about the level (wich whould be text.
Let me show you how to make a edit box wich shows the name of the author.
First create this edit box somwhere on the level
Then you create a event that looks like this:
-On Loop 'Save'
>Only One Action When Event Loops
+Add line to the list: ???|LevelName|MyName
This will add a extra line to the list/level wich contains the information to decided.
Then to load this information into a edit box you will need to do the following:
-On Loop 'Load'
>Get Element 1 (String Parser) = ???
>Get Element 2 (String Parser) = LevelName
+Then set Element 3 to the edit box you have created.
There you go. Im sorry if this was hard to understand.
This is my first article.
|
|
J.J
Registered 09/05/2003
Points 826
|