Ever wanted to make a game, and make a level editor for it? The idea popped in my head today. It's simpler than you think.
You will need MMF to make it...
You game will have to have it's levels in grid mode, but if it is possible to load levels they will have to be in grid mode.
It's somewhat simple, Once you get the hang of it.
First you make a tile selection system. Then divide your level up into a certain amount of squares. In this example we will say X is 15 and Y is 10. Now make a tile placing system(I usually use the keyboard. Make a flashing block or something to indicate where the tile will be placed...and add the following events so your block indicator will move to a selected place in the grid.
-Upon pushing Down...move "Flashing block placing indicator" Down from it's current position+15(or whatever the size of your grid blocks is.
-Do this with all directions-
-Make it so when you push enter an active of your backround is created and a backround picture is placed, then the active is destroyed.
Here comes the tricky part....
When the user pushes DOWN...in the array the current position of Y is changed to Y's current position +1.
When the user pushed Right...in the array the current position of X is changed to X's current position +1.
Do the same thing with Up, and Left(except negatives)
Now...write this down. Assign each tile with a number.
When ENTER is pressed the number of the selected tile is placed in the grid.
Finally add a save button...and make it so you can save the Array...
LOADING THE ARRAY...
When a user loads the array...make it so that in the first few seconds an active is created in all the gridspots with numbers purtaining to that tile. Then make them create backround obstacles, and your level is loaded!
Making all the tiles load can be tricky. You might try the following.
-Make an Active, and create all your tiles as animations within it.
Put in the following actions...
-ALWAYS>Place tilemaker at Tilemakers position +15(or the Height of your tiles), And Add one to Y dimension of array.
*when "tile maker is visible"
Now you need to make an action for each tile you have.
-Read value from array...
-If Value =1 Set animation of Tilesetter to TILE 1.
Then place this action.
-Every 00:02(or something like that) Place a backround picture of Tile Setter as an obstacle...
THERE YOUR DONE>....Hope it's not tooo confusing(by the way...I thought this hole thing up in about 3 seconds....literally---not joking)
Great Article Dan, i think it will be very helpfull for many people.
Posted by
2nd January, 2002
Why not use the excellent fastloop object when loading the levels. That would drastically decrease the time the engine would need to 're-build' the level.
Yeah, the fast loop object would be better, Daniel is right. But I guess that those who know and use the FLO also know how to use it here - and it's better for those who aren't that experienced just to stick with those basic functions of mmf.
Very helpful, Dan. Also, for those who have trouble drawing a grid, turn on the "grid" and "snap to" options to assist you better in drawing blocks with equal sizes. On top of that, if you're familiar with Cellosoft's Fastloop, it will speed up your loading tremendously.
I tried making a level editar a while ago, when I wasn't very experienced with MMF. I did it with all these active objects, and an active object that read all the tiles... it was very inefficient, and there were no good tutorials for level editors then. This is very good, and although since then I have learned enough to make one myself, this will be very helpful to people like I was then Mebbe I'll make a fastloop tutorial for this sometime.