Game Development Reference
In-Depth Information
Package Name
Functions
Description of Contents
javafx.scene
Scene con-
trol
Classes related to scene creation, organization, control,
and realization
javafx.stage
Stage cre-
ation
Stage creation classes
javafx.util
JavaFX
utility
JavaFX utility classes
netscape.javascript JavaScript
Allows Java code to invoke JavaScript methods and ex-
amine JavaScript properties
I have discussed some of these already, such as the javafx.application package
(see Chapters 2 and 3 ) and the javafx.scene package (see the section “JavaFX Scene
Package: Sixteen Powerful Java 8 Classes”). There are a few other JavaFX packages
that you should take a closer look at here, as they (along with the javafx.scene pack-
age) contain classes that you will want to use in your Java 8 game development (still
others, such as the javafx.print, javafx.fxml, javafx.beans, and javafx.embed packages
are not likely to be used in your Java game design and development work process);
these are javafx.animation , javafx.stage , javafx.geometry, javafx.concurrent , and
javafx.event . Let's take an in-depth look at what these packages provide for your game
development objectives next.
JavaFX Animation for Games: Using javafx.animation
Classes
The javafx.animation package contains the Animation superclass, which has the
Timeline and Transition subclasses as well as the AnimationTimer , Interpolator ,
KeyFrame , and KeyValue classes. Animation is an important design element in Java 8
games, and these animation classes are already coded for us, thanks to JavaFX, so all
you have to do to add animation to your games is use them properly!
The JavaFX Animation Class: The Foundation for An-
imation Objects
The Animation class (or object, actually) provides the core functionality of animation
in JavaFX. The Animation class contains two (overloaded) Animation() constructor
methods; these are Animation() and Animation(double targetFramerate) , and they
Search WWH ::




Custom Search