Pro Java 9 Games Development Leveraging the JavaFX APIs

(Michael S) #1
Chapter 18 ■ 3D Gameplay DesiGn: CreatinG your Game Content usinG Gimp anD Java

Enter the 45 -degree value into the Angle text field to rotate the parrot image so that it will be upright after
the game board spinner has selected the orange Animal quadrant. Leave your Center X and Center Y rotation
coordinates at the exact center of the 512-pixel texture map, which will be a 256 value, as shown in Figure 18-9.
Also shown in Figure 18-9 is the Rotate tool grid, which overlays the image being rotated. This will allow
you to more precisely visualize how your content is being rotated, using a 16x16 grid overlay of straight lines.
The settings for the Rotate tool and grid can be seen on the left of the Rotate dialog, where you can set
the number of grid lines (called guides), set the image preview option, set the rotation Direction, and set
the Clipping and image Opacity. As you can see, GIMP 2.8.22 can be a powerful tool for professional Java 9
games developers.
Notice the rotation grid guide is shown over the Steel Hoop layer since it is on (showing) in the layer
composition. If you wanted to see the rotation guide just on the round parrot image, you could turn off the
eye icons for the Steel Hoop and gameboardquad-animal layers. Remember, only the selected layer will be
affected by a Layer ➤ Transform ➤ Rotate operation, as GIMP is a modal software package that operates
only on a combination of selected layers, tools, colors, selection sets, and options. This makes it relatively
complex, yet this same feature makes it much more powerful than nonmodal digital imaging software.
Click the Rotate button to finish the rotation algorithm settings and apply the rotation to the image.
Now all you have to do is to export the image to the NetBeansProjects/JavaFXGame/src folder as
gamequad1bird1.png. Then we can go into the Java loadImageAssets() method and test the new texture
map by changing the diffuse21 map to reference this image, instead of the default one. (We’re doing this
temporarily so that we can see how it looks when rendered onto the 3D game board quadrant.)
Open NetBeans 9 and the JavaFXGame project. Then open the loadImageAssets() method body by
using the plus (+) icon in the margin and temporarily edit the diffuse21 texture used for the orange game
board quadrant to reference the gamequad1bird1.png file you just created using the following Java
statement, which is also shown in Figure 18-10 highlighted in yellow and blue:


...
diffuse21 = new Image("/gamequad1bird1.png", 512, 512, true, true, true);
...

Free download pdf