Subclassing in Verse
In Verse, you can create a class that extends the definition of another class by adding or modifying the fields and methods of the other class. This is often called subclassing or inheritance, because one class inherits definitions from the other class.
Let’s look at the Class Designer device as an example of subclassing. With the Class Designer device, you can create character classes for player characters that let you define the attributes and inventories specific to a character class, such as a tank or DPS (damage per second) character.
| DPS character class created with the Class Designer device | Tank character class created with the Class Designer device |
In Verse, you could create a tank class and a dps class like this:
tank := class():
StartingShields : int
MaxShields : int
AllowOvershield : logic
DamageReduction : int
You're reading a preview
The full reference is free for BrainDeadGuild Discord members — sign in to read it all, or open the original at the source.
Sign in with your BrainDead.TV / BrainDeadGuild Discord account for full access.