Planning behaviors

Behaviors are just a fancy way of saying things or interactions that will happen in the game. Breaking down these actions or reactions in this way helps to componentize how we think our game will work. Stopping and thinking about this from the very beginning means we won't get too many surprises later on. (There are always surprises after a good night's sleep.)

For example, behaviors can take the following forms:

  • Attacking another entity
  • Taking damage
  • Collecting the loot, which could be money or items
  • Teleporting to another land

Behaviors on classes should only affect the class that it is defined on. If you are going to affect another class's attributes, it should be through another behavior on that class.

Behaviors for the common ...

Get Mastering Unity 2D Game Development - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.