Java Reference
In-Depth Information
Figure 7-2 shows four different asteroid sequences that are all animated with several light sources,
but in the same location for each asteroid. This gives them a consistency within the scene. Note that the
buildings at the bottom are also illuminated in a way consistent to each other. You can also see that the
light on the asteroids might be coming slightly from the left, while on the buildings the light is coming
from the right. This is inconsistent, but I think it is close enough for a $1 game.
One criterion for this exercise is that the animation tool must be able to export the frames of the
animation as a sequence of images that JavaFX knows how to read. I find PNG files perfect for this task.
The demo code, shown later in the chapter, provides three examples of using images as frames in an
animation; the screenshots in Figure 7-3 show each example with a gradient background to highlight the
transparency.
Figure 7-3. Asteroid
Figure 7-3 shows an asteroid that was created with Blender. When animated, the asteroid appears to
be spinning.
Figure 7-4 shows a jack that I created to be a sort of space bomb in a video game I originally created
for the iPhone.
Search WWH ::




Custom Search