Narrat RPG demo updated to use more modern syntax

Narrat RPG Demo update

The narrat RPG demo (the one with a basic dungeon crawler and turn-based combat) was using pretty old syntax and hacks to work. For example, it had buttons defined in every screen for every possible enemy and player class.

Now that narrat has more advanced scripting features, it was time to update this demo to make better use of the tools available, so I cleaned it up to be a better example of how to do advanced scripting, and replacing usage of buttons with sprites

Changes

  • The demo now dynamically creates sprites for enemies and the player instead of predefined buttons in every possible screen
  • There are new enemies.yaml, classes.yaml and rooms.yaml containing data about those things to help the game scripts dynamically generate content based on what is added to those files. They get loaded into variables using the load_data command.
  • The game script has been split in a few files to be more readable
  • The game now has a load_sprite utility function which takes an object with info about a sprite and generates a sprite based on it. This might be moved as a command in the engine in the future, but it shows how easy it is to use narrat functions to create new utility tools
  • Added a new empty_sprites command to the engine which deletes all sprites on a layer, as it was needed for this demo.

You can see the changes in this PR to get an idea of the difference.

4 Likes