Completing the player's and the background's components

All the game objects are reliant upon or react to the player. For example, the aliens will spawn, chase and shoot relative to the player's position. Even the background will take its que for which way to scroll based on what the player is doing. Therefore, as mentioned previously it makes sense to get the player working first.

However, remember that using the Entity-Component pattern will mean that some of the components we code for the player will also be used when we implement some other game objects.

Tip

The author hopes the reader understands that if we hadn't coded the empty component classes before Transform and subsequently GameObject, that all these calls to the Transform class and ...

Get Learning Java by Building Android Games - 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.