Using behaviors to interact with our game
We can't really call our current creation a game, because there isn't any interaction! Players need to be able to react to what is happening in our game, or it won't be much fun so, in this part of the book, we are going to implement the following gameplay elements:
Controlling the monkey with the keyboard
Scrolling the scene as the monkey runs
Working with behaviors
Behaviors are the instructions, or rules, for our game. Currently, we have a scene and an actor, but we haven't implemented any rules relating to how our game will work.
Think of behaviors as the answers to questions that are asked when certain events occur in our game, such as the ones listed here:
What happens when the player presses keys on the keyboard?
What should happen when my actor reaches the edge of the screen?
What happens when my player actor bumps into an enemy actor?
The behaviors in our game can listen out for these mentioned events, and can then apply the rules that we have specified...