Hello! I’ve been making some decent progress on the level editor. In my last update, I’d just finished fighting with the code to pull information from the level data and display it in the editor panel. Having done that, making changes to that information was relatively trivial (although I did have to make a few more changes to the way the editor categories are stored). I implemented controls for increasing and decreasing values, and once that was working the changes you made were automatically reflected in the level, which felt really rewarding! Here’s a video:
After getting value editing working, I made a few more changes. First, I implemented functionality for moving the camera to a specific location. This will eventually be useful in the game (for highlighting a door that you’ve opened, for example), but in the editor it is used for centring the object you’re making changes to. To do this, I needed to make a system that takes an item from the editor, and returns a set of coordinates for the object that it’s associated with. For gears this would be the centre point of the gear, but for geometry vertices it would be the coordinates of the vertex itself, and so on.
Next I got buttons working. I forgot to demonstrate this in the video, but these are generally used for adding new elements; sections, gears, walls, that kind of thing. Then I needed a way of highlighting objects that you’re editing. I was mostly able to adapt the previous code for getting the location of an object, and use that to tell the code that draws all of the level objects to flash the currently selected object. It also draws a crosshair over whatever is most relevant to the item you currently have selected.
So, I think I’m finished with these systems for the time being. There are a few things that I need to work on next: A context menu that can be used for copy/pasting, deleting items, and undo; a secondary editor mode where you can move a pointer around the level directly, and select and move objects directly (this is going to be a big job); a system for determining a better location for newly-created objects (currently these get spawned at (0, 0), but this can often be quite far away from where you want them to be).
See you next time!