Posted November 22, 2024 by taejaun100
#2d #encounters #battle system
Overview:
This update covers the addition of two major systems: the Monster Creation System and the Random Encounter System. The Monster Creation System allows for flexible monster generation using ScriptableObjects
, while the Random Encounter System introduces chance-based battles as players explore designated areas, adding excitement and unpredictability to the gameplay.
Details:
MonsterBase
ScriptableObject class that defines the core attributes of each monster, including name, description, sprite, type, max HP, attack, and defense.
Monster
class allows individual monster instances to scale with level, dynamically adjusting stats like HP, attack, and defense. Skills are also assigned based on level, with each monster able to learn up to four skills.
BattleTrigger
script that attaches to specific zones. A battleChance
variable controls the probability that a battle will start when the player enters a zone.
Encounter
class in BattleTrigger
defines possible monsters for each zone, with an encounterRate
determining each monster’s chance of appearing if a battle is triggered.
BattleManagerMain
to start the battle. The system includes a cooldown to prevent frequent encounters.