Loading

Unity Action RPG

This project began as an idea for an Diablo-like game to learn Unity. It has since then evolved into script collection for a general 2d action RPG with enemies, attacks, equipment and items. The idea is that minimal code changes should be made when creating a game. Scripts are added to GameObject (in the most basic case a Sprite) to create new Enemies, Items and Equipment where the only changes needed lie in the script properties.

Here follows some of the basic MonoBehaviours:

EnityStats is attached to all Enemies or Player objects. The stats determine how fast an object can move and attack and how much damage it can take before it is removed. All stats may be changed, either by Items, Equipment or StatusEffects.

The player and all enemies are composed of a Sprite, a Collider2d, EntityStats, DamageDealer, DamagerTaker and Mover.

Attacks are created as a GameObjects with a sprite, a Collider2d, (sometimes and RigidBody) and Attack-script. The Attack is then attached to a Weapon-script or directly to an Attacker-script. It is then activated (see Object handling) when the attacker is attacking and will trigger damage for a DamageTaker on TriggerEnter or CollisionEnter.

Items are created as a GameObject with a Sprite, a Collider2d and an Item-script. An Item may have an Effect which can be triggered when the item is used. The Item may have a defined number after it will be removed. Items may also be stackable.

Equipment can be added to an Item object which will Equip the Equipment when the Item is used. An Equipment may change status of the EntityStats which Equipped the Equipment.

Weapon is a subclass of Equipment and contains an Attack and AttackProperties which the attack will use.

The source code can be found at:
https://gitlab.com/Kajonn/dungeon-brawl-unity-scripts