[JAVA][Beginning Java 8 Games Development].pdf

(45852 KB) Pobierz
www.it-ebooks.info
For your convenience Apress has placed some of the front
matter material after the index. Please use the Bookmarks
and Contents at a Glance links to access them.
www.it-ebooks.info
Contents at a Glance
About the Author �½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½
xix
About the Technical Reviewer �½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½
xxi
Acknowledgments �½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½
xxiii
Introduction �½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½
xxv
Chapter 1: Setting Up a Java 8 Game Development Environment �½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½1
Chapter 2: Setting Up Your Java 8 IDE: An Introduction to NetBeans 8�½0 �½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½19
Chapter 3: A Java 8 Primer: An Introduction to Java 8 Concepts and Principles �½�½�½�½�½�½�½�½�½�½�½43
Chapter 4: An Introduction to JavaFX 8: Exploring the Capabilities
of the Java 8 Multimedia Engine �½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½75
Chapter 5: An Introduction to Game Design: Concepts, Multimedia,
and Using Scene Builder�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½101
Chapter 6: The Foundation of Game Design: The JavaFX Scene Graph
and the InvinciBagel Game Infrastructure�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½123
Chapter 7: The Foundation of Game Play Loop: The JavaFX Pulse System
and the Game Processing Architecture �½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½145
Chapter 8: Creating Your Actor Engine: Design the Characters for Your Game
and Define Their Capabilities�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½165
Chapter 9: Controlling Your Action Figure: Implementing Java Event Handlers
and Using Lambda Expressions �½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½187
Chapter 10: Directing the Cast of Actors: Creating a Casting Director Engine
and Creating the Bagel Actor Class �½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½207
Chapter 11: Moving Your Action Figure in 2D: Controlling the X and Y
Display Screen Coordinates �½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½229
v
www.it-ebooks.info
Contents at a GlanCe
Chapter 12: Setting Boundaries for Your Action Figure in 2D: Using the
Node Class LocalToParent Attribute �½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½251
Chapter 13: Animating Your Action Figure States: Setting the Image
States Based on KeyEvent Processing �½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½273
Chapter 14: Setting Up the Game Environment: Creating Fixed Sprite
Classes Using the Actor Superclass �½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½299
Chapter 15: Implementing Game Audio Assets: Using the JavaFX
AudioClip Class Audio Sequencing Engine �½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½323
Chapter 16: Collision Detection: Creating SVG Polygons for the Game Actors
and Writing Code to Detect Collision �½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½343
Chapter 17: Enhancing Game Play: Creating a Scoring Engine,
Adding Treasure and an Enemy Auto-Attack Engine �½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½393
Index �½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½455
vi
www.it-ebooks.info
Introduction
The Java Programming Language is currently the most popular object-oriented (OOP) programming language in
the world today. Java runs on everything from SmartWatches to HD Smartphones to Touchscreen Tablets to eBook
Readers to Game Consoles to SmartGlasses to Ultra-High Definition (UHD) 4K Interactive Television Sets, with even
more types of consumer electronics devices, such as those found in the automotive, appliances, health care, digital
signage, security, and the home automation market, increasingly adopting the open source Java platform for use in
their hardware devices as time goes on.
Since there are literally billions of Java compatible consumer electronics devices, owned by billions of users all
over the world, it stands to reason that developing popular Java 8 Games for all of these people could be an extremely
lucrative undertaking, given that you have the right game concept, artwork, game design, and optimization work
process, of course.
Java 8 (and its multimedia engine, JavaFX 8) code can run on just about every operating system out there,
including Windows XP; Vista, 7, 8, and 9; all Linux distributions; 32-bit Android 4 and 64-bit Android 5; Open Solaris;
Macintosh OS/X, iOS; Symbian, and Raspberry Pi – it’s only a matter of time before the other popular OSes add
support for this popular open source programming language. Additionally, every popular Internet browser has Java
built in! Java provides the ultimate flexibility in installing software, as an application, or in the browser as an applet.
You can even drag a Java application right out of the browser, and have it install itself on that user’s desktop! Java 8 is a
truly remarkable technology.
There are a plethora of embedded and desktop hardware support levels currently for Java 8 (and for JavaFX 8.0)
including the full Java SE 8, Java SE 8 Embedded, Java ME (Micro Edition) 8, and Java ME 8 Embedded, as well as
Java EE 8 for Enterprise Application Development. Talk about being able to “code once, deliver everywhere!” That is the
dream of every programmer, and Oracle is making it a reality with the powerful Java 8 multimedia programming platform.
This book will go a long way toward helping you to learn exactly how to go about developing Java 8 games, using
the Java programming language in conjunction with the recently added JavaFX 8.0 multimedia engine. These Java 8
game applications will be able to run across a plethora of Java compatible consumer electronics devices. Developing
Java 8 game applications that play smoothly across all of these different types of consumer electronics devices
requires a very specific work process, including asset design, game code design, and optimization, all of which I will
be covering during this book.
I wrote the Beginning Java 8 Game Development title from scratch, using a real-world client game project that I
am actually working on, and will be delivering to the public sometime in 2015. I am targeting those readers who are
Beginning Game Developers, and who had not coded in Java 8 and JavaFX 8.0. These readers are technically savvy, but
they are not that familiar with object-oriented computer programming concepts and techniques. Since Java is now at
Version 8u40, this book will be more advanced than many of the other Java books out there. Java 8 has added some
very advanced features, such as the JavaFX 8.0 API, which gives Java 8 its own multimedia engine, supporting SVG, 2D,
3D, audio, and video media.
I designed this book to contain a comprehensive overview of the optimal Java 8 game development work
process. Most beginning Java application development books only cover the language, however. If you really want to
become that well-known Java game application developer that you seek to become, you will have to understand as
well as master all of the areas of game design, including multimedia asset creation, user interface design, Java 8
Programming, JavaFX 8.0 class usage, and data footprint, memory, and CPU usage optimization. Once you’ve
mastered these areas – hopefully, by the end of this book, you will be able to create the memorable user experience
that will be required to create popular, best-selling Java 8 games. You can do it; I know you can!
xxv
www.it-ebooks.info
Zgłoś jeśli naruszono regulamin