Page 1 of 1

Level Editor for generic Tower Defense

Posted: Tue Oct 17, 2017 5:51 pm
by nyenye
Working on a TowerDefense kind of game and didn't want to use Tiled as a level editor, so I've made this little thing.

What does it do:
  • Load an image to set as background. (/res/test.png in the example).
  • Change number of waves for the Level.
  • Switch between three main tools (GOAL, BUILDING, SPAWN). Each of them, represents a common thing in a classic TowerDefense:
    • GOAL: Point that enemies try to reach. Can be more than one.
    • BUILDING: More specific would be building point, and it represents a spot where the user can build a tower.
    • SPAWN: Again, represents a spawn point. Where enemies will come from.
  • Can create new entities with the main click.
  • Can drag and drop created entities, to reposition them on the map.
  • Can remove entities with the second click.
  • When selecting a SPAWN entity, a menu is shown, where you can add, edit, and remove enemies for each wave.
  • A help dialog is shown at the bottom. Can be disabled by pressing H.
  • Save edited level by pressing CTRL+S
  • Restore last deleted entity by pressing CTRL+Z (only last one)
When the Level is saved, it will save at '/res/result.lua', it returns a well formatted object with everything that you set up on the editor. Then you have to take care to parse the file on the game itself.

NOTE: Right now I haven't found the way to save the file when the tool is executed as a .love file. To make it work right now, it should be executed from the terminal/cmd. Sorry for that!

Code: Select all

cd level_editor_directory
love ./
Github: https://github.com/nyenye/td-level-editor

EDIT: Updated. Just code refactoring.