Game Development Reference
In-Depth Information
}
public void update (float deltaTime) {
}
public abstract void render (SpriteBatch batch);
}
This class is able to store the position, dimension, origin, scale factor, and angle
of rotation of a game object. Its methods, update() and render() , will be called
inside our world controller and renderer accordingly. The default implementation
to update a game object is currently empty. So, the game objects inheriting from
AbstractGameObject will do nothing when updated. For rendering, a specific
implementation has to be provided for each game object because we defined the
render() method to be abstract .
The rock object
The rock game object basically consists of three distinct parts: a left edge, a middle
part, and a right edge. There is one specialty about the middle part: it must be
repeatable to be able to create different rocks with arbitrary lengths. Furthermore,
the image for the right edge can be easily created by mirroring the image of the left
edge. This means that we will need only two textures from our texture atlas to draw
a complete rock of any size, as shown in the following screenshot:
 
Search WWH ::




Custom Search