I've been trying to throw a level editor together for a few days now, but it's proving to be more difficult than I originally anticipated.
If anyone could link me to any good tutorials, I'd appreciate it.
Thanks.
-The Almighty Zen Taco
Printable View
I've been trying to throw a level editor together for a few days now, but it's proving to be more difficult than I originally anticipated.
If anyone could link me to any good tutorials, I'd appreciate it.
Thanks.
-The Almighty Zen Taco
try the old and still excellent source of information Clickteam deactivated forums
http://www.clickteam.com/CTforum/categories.php3
search in the file archive, you'll find excellent source files for level editors with many great ideas.
Well it's a complex process but I pulled it off using the INI object to store each row of tiles into strings labeled 0, 1, 2, 3, etc. and have it loaded into a text blitter object with the tiles loaded from a BMP and then had a fastloop generate an anonymous active object which creates a backdrop object depending on the portion of the string it's over, although it's easier said than done since it requires complex mathematical equations to change the tile the cursor is over.
I should think it would go without saying that using an array would be the easiest way of writing to a file.Quote:
Originally Posted by Corlen
When dealing with map loading I think the best equations to use are:
number_of_tiles = [color:#000099]level_width*level_height[/color]
start loop "draw" ([color:#000099]number_of_tiles[/color]) times
on loop "draw"
set draw x to: [color:#000099](loop_index("draw") mod level_width)*tile_width+0[/color]
set draw y to: [color:#000099](loop_index("draw") / level_width)*tile_height+0[/color]
paint/create backdrop
at this point I usually use the binary object where you can use the getByte(loop_index) function to create different tiles (either using active object direction or the active picture offsetxy)
To get your cursor object to hover tiles then use:
Xcursor = [color:#000099]min(max(((xmouse-0)/tile_width)*tile_width,0),tile_width*(level_width-1)+0[/color]
Ycursor = [color:#000099]min(max(((ymouse-0)/tile_height)*tile_height,0),tile_height*(level_hei ght-1)+0[/color]
If your level doesn't start at (0,0) MMF2 coordinates then replace "0" in all the examples above with the value it starts at
Recently i've been playing around with the TextBlitter but if your planning on developing levels larger than about 64*64 then you would probably be looking for a system of custom load on call backdrops or active objects (with them you can simulate layers without needing to use the extra memory or CPU).