I have an infinite runner where it continuously spawns multiple trees moving up (sorta like the asteroids in the Space Shooter tutorial). If the player runs into the scrolling trees, I want the trees to all stop moving as well as the background. What is the correct way to do so? Currently only my GameController is aware of the gameOver variable. Do I -
- Declare a GameController reference in each tree instance?
- Move the gameOver variable into a singleton and reference that from each tree instance?
- Other better suggestion?
Not sure of best practices, any help is appreciated! Thanks