Game Creator
  • Welcome to Game Creator!
  • Quickstart
    • Get Started
    • Setup
    • Tutorials
  • Game Creator
    • Game Creator
      • Actions
      • Conditions
      • Triggers
      • Hotspots
      • Characters
        • Player
        • Markers
        • Gestures
        • States
        • Advanced
          • IK in custom Animations
      • Camera
        • Camera Motors
      • Variables
        • Global Variables
        • Local Variables
        • List Variables
    • Systems
      • Localization
      • Event System
      • Timeline
      • UI
      • Module Manager
      • Game Creator Toolbar
      • Pool System
      • Game Creator API
        • Custom Actions
        • Custom Conditions
        • Custom Triggers
        • Custom Hooks
        • Custom Save & Load
        • Variables Access
        • Custom Module
  • Dialogue
    • Dialogue
      • Anatomy
      • Actors
      • Dialogue UI
      • API
  • Inventory
    • Inventory
      • Inventory Window
        • Catalogue
        • Recipes
        • Types
        • Settings
      • Merchants
      • Containers
      • Loot Tables
      • Equip Items
      • Actions
      • Conditions
      • Custom Inventory UI
  • Quests
    • Quests
      • Quests Overview
      • Create Quests
      • Quests UI
        • Custom UI
  • Stats
    • Stats
      • Stats Overview
        • Stat
        • Attributes
        • Status Effects
        • Formulas
        • Stat Modifiers
      • Stats UI
      • Common Use Cases
        • Simple Health Bar
        • Regenerative Mana
        • Poison Status Effect
        • Levels and XP
        • Strength and Armor
        • Lockpicking
  • Behavior
    • Behavior
      • Behavior Graph
        • Nodes
        • Blackboard
      • Perception
  • Shooter
    • Shooter
      • Weapons
      • Ammunition
      • Interaction
      • Examples
        • Example 1 - Get Started
        • Example 2 - Pick Weapons
        • Example 3 - Top Down
        • Example 4 - Side Scroll
        • Example 5 - First Person
        • Example 6 - Combat
      • Advanced
        • Custom Crosshairs
        • Shooter API
  • Melee
    • Melee
      • Weapons
        • Blade Component
      • Shields
      • Melee Clips
      • Combat
  • Traversal
    • Traversal
      • Obstacles
      • Climbables
      • Built-in Elements
  • Annex
    • Roadmap
    • FAQ
Powered by GitBook
On this page
  • Mana Regeneration
  • Fireball Spell

Was this helpful?

  1. Stats
  2. Stats
  3. Common Use Cases

Regenerative Mana

+1 +2 +3 +4...

PreviousSimple Health BarNextPoison Status Effect

Last updated 6 years ago

Was this helpful?

A lot of games feature some kind of regenerative gauge. It can either be health after a short delay of not receiving damage or a small but constant increase of the energy/mana points.

The Stats module's second example shows how you can implement regenerative mana as well as casting a spell only if there's enough points.

Mana Regeneration

To regenerate mana over time is as easy as creating a Trigger that invokes an Actions object as soon as the game starts. These Actions are:

  • Increase the Mana attribute by 5

  • Wait 0.1 seconds

  • Restart the Actions object

This sequence will ensure that every 0.1 seconds, the player's mana attribute will increase by a small portion.

You can also use the value of another Stat as the amount of mana recovered so that it takes into account possible Status Effects or the current level of the player.

Fireball Spell

To cast the Fireball we first need to know if there is enough mana in the player's gauge. To do so, we simply use a Trigger that detects when the user has pressed the Left Mouse button. As soon as that happens it invokes an Event which checks if there's enough mana to cast the spell.

Then, to actually cast the spell we use the Instantiate Action, which creates an instance of a prefab we have previously designated as the Fireball.

When casting a Fireball the player also plays a Gesture so the effect looks fancier.

(The player casting a Fireball)
(Fireball cast Event)