Every GameObject has a transform

As we learned earlier in the chapter in the Entity-Component pattern section, every GameObject will have a Transform class as a member. The Transform class will hold all the data and perform all the operations that are common to all GameObject instances- plus a bit more. In a fuller game engine, the Transform class would typically be quite a small class but we are going to cheat and make it quite big in order to incorporate some data and methods that wouldn't typically be part of Transform.

We are doing it this way to stop the structure of our code becoming even more complicated. While planning the book it seemed that the structure of this project had already increased in complexity. Therefore, this class will ...

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.