This is a demo for a quiz (turn) based combat system for GBStudio. The zip file includes all files needed to import this demo into GBStudio. Feel free to use/change it as you like. There is no need to credit me. But I would like to see what you came up with, if you are using this. 

Instructions

Interact with the NPC to start the quiz and try to answer the questions.

WASD/Arrow Keys -> Movement

Z/J/Alt -> Interact

How does it work?

The basic idea is to set two variables at the beginning of the quiz. The first one for the player health and  the second one for the enemy health.

The multiple choice scripting event is used for the possible answers. It sets the question variable to true or false, depending on the players choice.

Then the question variable is checked for the desired value (which is true if the first multiple choice option is the correct answer and false if the second one is correct). If the question variable is the desired value the enemies health is decreased by one. If the question is not the desired value the players health is decreased by one. 

Decreasing the health variables and animating the character sprites and health bars is done by the dealDamage custom event. You just have to pass in the correct and corresponding health variable, character actor and health bar actors.

The health (questionmark) bar animation is also done by the dealDamage custom event. It uses the health variable to determine the correct animation frame. The supported starting health values are 2, 4 and 6. The starting health defines how much health bar actors are needed. A starting health of 2 needs 1 health bar actor, a starting health of 4 needs 2 health bar actors and a starting health of 6 needs 3 health bar actors. If you only have got one health bar actor it does not matter what you pass as Healthbar2 and Healthbar3 into the dealDamage event. 

After each question the checkWinCondition custom event is used to decide whether the quiz is over. It checks if the player or enemy health is zero. If the player health is zero it switches to the Game Over Scene. If the enemies health is zero the previous scene is restored from the stack to switch back to the "world map". So the current scene always has to be stored on the stack before switching to a quiz scene. 

The player and enemy names and sprites are actors so the same background can be used for multiple quizzes (and you can do a neat hit animation for the characters). Of course the characters and names could be part of the background too.

Download

Download
quizBasedCombatDemoGBStudio.zip 63 kB

Leave a comment

Log in with itch.io to leave a comment.