Game mechanics and how to create with code (components)
This section will explore the concept of game mechanics and what that means for the gameplay in the Outer World collection game we’re making. We’ll define precisely the mechanic we’ll be using in a brief expansion on the Game Design Document (GDD) and finish with writing the code for the mechanic by adding a new Prefab with a custom component that uses a 2D physics interaction event.
What is a game mechanic?
A game mechanic can loosely be defined as the rules that dictate the gameplay and how the player is supposed to engage with the mechanics sufficiently to provide a joyful and entertaining experience. Examples of some popular types of gameplay mechanics include collecting, moving, shooting, and building things.
Some game mechanic rules that dictate gameplay are followed by the game and not the player, such as the game only unlocking a new level when the player completes the current level.
Buff...