June 2013
Intermediate to advanced
346 pages
8h 42m
English
Now that we have an object builder, we’ll need to update our Mallet class since we’re no longer drawing it as a point. We’ll also need to add a new Puck class. Let’s start with the puck. Create a new class in the same package called Puck, and add the following code to the class:
| AirHockeyWithImprovedMallets/src/com/airhockey/android/objects/Puck.java | |
| | private static final int POSITION_COMPONENT_COUNT = 3; |
| | |
| | public final float radius, height; |
| | |
| | private final VertexArray vertexArray; |
| | private final List<DrawCommand> drawList; |
| | |
| | public Puck(float radius, float height, int numPointsAroundPuck) { |
| | GeneratedData generatedData = ObjectBuilder.createPuck(new Cylinder( |
| | new Point(0f, 0f, 0f), ... |
Read now
Unlock full access