Log In  
Follow
codlark
[ :: Read More :: ]

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

P#39738 2017-04-17 15:31 ( Edited 2017-11-14 03:52)

Follow Lexaloffle:          
Generated 2024-04-19 10:19:40 | 0.063s | Q:8