Chapter 5. GameplayKit
For many years, video game development has relied on the tenets of object-oriented design (OOD). Of the core features in OOD, the concepts of inheritance and polymorphism have been the most useful in this branch of software engineering. It makes sense to think of entities in our games as homogenous groups of objects; objects that we then write rules for in how they interact with each other. For example, thanks to inheritance, all objects in our game can be given the class name of GameObject
; they have functions we'll use throughout the game and then we can branch them off into child classes, such as Player
or Enemy
. We can then continue that thought process as we come up with more specific types of entities, be they objects such as Player
, different enemies, non-player characters (NPCs), or whatever makes sense for the game we are making. Calling a function on those objects, such as Shoot()
or Health()
, could be unique for each child of the parent class...