Game Development Reference
In-Depth Information
learning how these classes work! The Java code for changing a StackPane object's im-
port, declaration, and instantiation into a Group object should look like the following
Java code, which is also shown in
Figure 16-42
:
import javafx.scene.
Group
;
//
replaced StackPane import with Group
public class InvinciBagel extends Application {
// all
other object declarations omitted
Group
root;
public void start(Stage primaryStage) {
// all
other object instantiations omitted
root = new
Group
();
Figure 16-42
.
Replace the StackPane UI container with the Group (Node subclass) import, declaration and instanti-
ation
After you make these changes and
Run Project
, you'll see the result shown on
the left half of
Figure 16-43
. The game is now using an upper-left 0,0 origin, so we'll
have to modify the rest of the existing code. Let's do that now.