GDevelop Turn-Based Battle Script Demo
About
Controls: Just click or tap the screen when it's the player's turn. (You'll see text instructions on the screen when it's the player's turn.)
Attack Description will appear at the bottom of the game screen, so you can see what the enemy has done.
This is a demo to show off the custom behavior functionality in GDevelop, in the form of a basic AI battle script. Please read the description for details.
Sprite Credits: Credit for sprites and assets goes to the creators of GDevelop's official platformer tutorial. The tutorial and assets are publicly available here: https://wiki.gdevelop.io/gdevelop5/tutorials/platformer/start
Everyone knows that the best weapon against an alien is a sugary diet (pretty sure that info's been declassified...). As such, this demo shows you how our alien protagonist would fare against a pink pile of sugary goo, which comes equipped with its own battle script of cavity-riddled attacks.
This is merely a demo of how to create a sample battle script for an enemy (or maybe even a friendly NPC ally) in GDevelop, using custom behaviors. The idea is similar to the battles in turn-based JRPGs such as the Final Fantasy games, Chrono Trigger, or Earthbound. In fact, the idea was inspired by the final encounter with the Guardian enemy and its battle scripts of previously-vanquished foes in Final Fantasy 6.
The demo is very simple, so you can easily see how to add a behavior extension and call it from your event sheet. There's also text on the screen to show how different variables and states are changing as the action progresses, to help you better visualize what's happening behind the scenes.
For simplicity, the player does not take any action in this demo, so you just click or tap on the screen to end the player's turn. But you could come up with logic to add the player's actions.
Similarly, the enemy attacks are all chosen randomly, and are just mostly a text message and a change to health or status. But once you understand the concept you can embellish with effects and improved logic (for instance, maybe you don't try to mute a player that's already muted, or add enemy health and a command that makes the enemy heal if the health is below a certain point).