Coding the inanimate and decorative components
In the previous chapter we coded all the interfaces for our component classes. We coded GraphicsComponent
, UpdateComponent
and InputComponent
. Now we will code the three simplest component classes that will be enough to complete quite a few of our specifications.
Let's start with the DecorativeBlockUpdateComponent
.
DecorativeBlockUpdateComponent
The update-related components all implement just one method, update
. Add a new class called DecorativeBlockUpdateComponent
, implement UpdateComponent
and add the empty update
method as shown next.
class DecorativeBlockUpdateComponent implements UpdateComponent { @Override public void update(long fps, Transform t, Transform playerTransform) { // Do nothing // Not even set a collider } }
Yes, the update
method is meant to be empty as the decorative objects don't move or collide.
InanmiateBlockGraphicsComponent
Add a new class called InanimateBlockGraphicsComponent...