Log In  


Cart #40582 | 2017-05-14 | Code ▽ | Embed ▽ | No License
7

LLE is a level editor that supports multiple layers, with each layer stored on cart as different sections of the map. LLE works by loading the sprite and map data of a user's cart, making changes, and saving back to the cart. Be sure to download LLE for best effect!

For demo purposes the cart comes with a small selection of sprites and a level made with them to show off the editor can do, but otherwise to actually use LLE you have to tell it where the layers are and how big the level is; all layers are considered the same size.

working_cart = "" --file name (with .p8) of the cart you want to edit
lvl_size = {width,height} --in map cells, overall size of the level
lvl_layers = { --starting point of each layer of the level on the map
  {x,y}, --each layer is an x,y pair, like so
  {x2,y2}
}

The optional function level(), found below the settings, is then copied to your cart and called to draw the level

function level(sx,sy, --screen position in pixels to draw the level
  size,layers, --same as lvl_size and lvl_layers above
  visible --optional, a table of true or false values indicating which levels to draw, if nil or left off, all layers will be drawn
)

You don't have to use level(), you can use LLE to ensure that a scrolling background matches the rest of the level and use your own parallax-draw function, or use the different layers to make different levels that use the same background layer, or make a huge map and chunk it into layers to edit easier, or make a bunch of small variations of the same level, or whatever you want.

LLE works more or less like the built in editors, specifically it can:

Save and Load - The active level can be saved and reloaded from the pause menu
Full Screen - The sprite window can be hidden from view
Zoom - The level can be zoomed from 25% to 200% in increments of 25 points
Draw - Left click to place a sprite in a cell, right click to select the sprite under the cursor
Pan - Pan around the map, or use the direction keys
fill - Flood fill an area of the map with the selected sprite
Layer Selector - On the left edge of the middle bar; left click to select a layer to draw on, right click to toggle layer visibility
Sprite Selector - Select a sprite to draw with using a familiar interface
Status Bar - The status bar reports on location of mouse, status of saves, etc.
Undo - new Undo the last made change by pressing Z
Select - new Use the select tool to select a region on the level
Copy - new Press X to copy the selection from the active layer to the clip board
Paste - new Use the stamp tool to paste the contents of the clip board onto the active layer of the level.

The next planned features are an autosave feature using a packed string format and sprite sizes other than 1x1; I have a few more ideas, like storing selected tool/sprite/layer to CDATA, but that's what I'm gonna work on next. But I'm always interested in suggestions for more :)

change log

v1.0

  • added undo and copy/paste functionality
  • redrew tool icons
  • changed demo level

V0.8 - initial release

7


Oh wow... this is just perfect timing.

I'm planning how best to build the level (room) editor for SCUMM-8 and you appear to have already proven some concepts I was thinking about. Seriously, well done! :o)

I wondered if it would be acceptable to require users to specify the cart (or in my case, carts) to import/export to - rather than relying on an in-editor "keyboard". Seeing yours in action gives me confidence that's the way to go.

In my editor, I'd have liked to give ppl the ability to edit actual sprites, rather than making them crack open the other cart, edit it, then reload in editor. Dunno if that's a feature you'd be interested in?

Of course, I hadn't thought far enough of how to actually implement it! - I wondered about letting users take advantage of PICO8's built-in editor, but as soon as your press ESC, there's a risk of losing any unsaved data. On the other hand, re-inventing the sprite editor seems redundant.

Would you mind if I "take inspiration" from some of your editor code? Ultimately, my game editor will be VERY specific (unlike your usefully-generic editor), as I'd want to provide ability to edit room/object/actor data all in one place.

Either way, congrats on your progress thus far! :o)


Thank you! I honestly hadn't thought about losing unsaved data when the user hits ESC, but I was thinking about creating a packed string representation of levels, and I can probably use that to autosave to the clipboard.

As for editing sprites, I feel ya, it's awkward to have to go in and out of two carts with any regularity, but I generally believe a program should do one thing and do it well, a belief well suited to the limits of PICO-8. Maybe if there was a way for one cart to cede control to another cart without overwriting what was already in base ram... Anyway, feel free to borrow some ideas; I based this app on the level editor in RPG maker, I'm using the same basic UI as the builtins, and I wouldn't have even attempted this if not for Tiny Animator by TRAVERSAL_DOG (thanks btw), so if LLE inspires you go ahead.


Good idea about the clipboard. If it helps, I think musurca's PiCAD has a similar auto-save feature (albeit, I think his prints to a file).

I like your point about "a program should do one thing and do it well" and I think you're right; I guess it's also in line with the Single Responsibility part of SOLID design. So, I may rethink trying to make an editor that's an all-in-one job. Either way, certainly given me something to think about.

Thanks again and all the best with your editor! :D


Damn this is pretty incredible.



[Please log in to post a comment]