Sunday, January 16, 2011

Level Editor

Hey there... been a while, eh?  I've been away for a while, both for work and because I've been pretty sick.  But lately I've been feeling better and had some time so I fired up the engine and got the Sprite Demo working with the new namespace.  In doing so, I also got a renewed interest in the Level Editor for 2D platformer style games.  I spent a fair amount of time getting things reorganized and cleaned up.



I've added different types of editors to the property panel and I've also brought in some additional libraries to take care of some of the UI stuff.  I modified the CollisionBox object so it has two forms: collider and trigger.  The second one being a block that will trigger some script when it is touched.  The script is totally arbitrary and assigned in the editor.  Another big thing I've added is saving and loading of  the level you're editing.  Right now it depends on having localStorage support, but I plan on adding an export/import feature so that a level can be exported to a text file and inserted into either your game or into an editor on another machine/browser.

It's a little slow, at the moment, because it does everything in a big loop.  The saving is the slowest part, but there can be a lot of data being streamed into and out of localStorage via R.storage.PersistentStorage.  I have ideas about how to speed this up, but for the time being it's working (and saving me the headache of recreating my level data each time)!  Since it seems my website is down (again) here's a link to the editor so you can play with it:

Sprite Demo with Editor

Any feedback would be appreciated!  Thanks.

PS: I forgot to mention that there is a context menu in the "Level Objects" tree on the right side.  From there you can create collision and trigger blocks, plus copy the currently selected object (and its properties).

No comments:

Post a Comment