Level Editor Tech Demo
Summary
This school project was done in C++. It was my first attempt in creating a level editor in my teacher's game engine "Mosaic". I wanted to incorporate drag and drop, level save, and a feature to change from editor mode to game mode and see the change.
Floor/Wall
Drag and Drop
I wanted a way to create the floor and walls in a more effective way other than taking each floor or wall tile and place them individually. So I decided to create a drag and drop feature for the floor and walls. I got the minimum and maximum mouse position, and from there I was able to determine the length and width. Then, depending on the length and width, when I release the button I would add the amount of tiles to be spawned in a buffer. For rendering in the floor tiles while holding the button, I created a function that would temporarily render them according to the limits of the bounding box.
Tile Renderer Function
​
Floor Tile Drag
Wall Tile Drag
Level Save
Each level has their own text file that the editor writes data into. Whenever you switch levels to work on it, my load level function would clear the entity count for each entity type, letting me rewrite the data for each entity at it's respective address.
Showing that the entities positions are saved as the level gets changed.
Entities
Each entity was added to the left of the window in their own respective axis aligned bounding box. This is where the user is able to click on the entity and is able to "paste" the entity into the level.
Showing that the entities can be dragged from the right and into the level.