Stat Increase
Increase a stat (float) and optionally send an event when it reaches or crosses a threshold.
This is ideal for:
- XP and Level Up
- Score and Extra Life / Bonuses
- Heat / Overheat meters
- Charge-up bars, special meters, progress
Parameters
| Parameter | Description |
|---|---|
| Stat | The stat value to increase (e.g., XP, Score, Heat). |
| Amount | How much to add to the stat. Can be used per second for gradual increases. |
| Threshold | The threshold value to compare against when using Event On Threshold. |
| Event On Threshold | Event sent when the stat reaches or crosses the threshold this frame. |
| Store Reached Threshold | (Optional) Stores true if the stat is greater than or equal to the threshold after the increase. |
⚙️ Details
- The action adds Amount to Stat.
- If Event On Threshold is not set, the action behaves like a simple stat add.
- If Event On Threshold is set:
- The action compares Stat against Threshold before and after the increase.
- If it was below the threshold before, and greater than or equal to the threshold after, it sends Event On Threshold.
- This means the event fires once when you cross the threshold, not every frame.
- Stat is not clamped – it can go beyond the threshold (e.g., XP can spill over).
If you use Store Reached Threshold, it will be:
truewhenStat >= Thresholdafter the increasefalseotherwise
You can also use the Per Second option to add Amount each second, for things like:
- Gradual XP gain over time
- Heat / stress meters building up
- Charge-up bars filling continuously
Example Uses
-
XP and Level Up
- Stat: XP
- Amount: XP gained for the action
- Threshold: XP needed for the next level
- Event On Threshold: LevelUp
- When XP crosses the threshold, LevelUp is sent. You can then handle leveling logic in a separate state (e.g., increase level variable, reset XP, raise threshold).
-
Score and Extra Life
- Stat: Score
- Amount: Points awarded
- Threshold: Score needed for an extra life
- Event On Threshold: ExtraLife
- When Score reaches the threshold, ExtraLife is sent - you can then award a life and optionally adjust the threshold for the next reward.
-
Heat / Overheat
- Stat: Heat
- Amount: Heat added when firing weapons or boosting
- Threshold: Overheat limit
- Event On Threshold: Overheated
- When Heat crosses the threshold, Overheated is sent - switch to a cooldown state, disable fire, etc.