did-you-know? rent-now

Amazon no longer offers textbook rentals. We do!

did-you-know? rent-now

Amazon no longer offers textbook rentals. We do!

We're the #1 textbook rental company. Let us show you why.

9781598631500

Beginning Java 5 Game Programming

by
  • ISBN13:

    9781598631500

  • ISBN10:

    1598631500

  • Edition: 1st
  • Format: Paperback
  • Copyright: 2006-04-25
  • Publisher: Cengage Learning Ptr
  • View Upgraded Edition
  • Purchase Benefits
  • Free Shipping Icon Free Shipping On Orders Over $35!
    Your order must be $35 or more to qualify for free economy shipping. Bulk sales, PO's, Marketplace items, eBooks and apparel do not qualify for this offer.
  • eCampus.com Logo Get Rewarded for Ordering Your Textbooks! Enroll Now
List Price: $29.95

Summary

If you are interested in creating games for the casual game market, then get ready to set the wheels in motion! This hands-on guide for beginners allows you to increase your skill level along the way as you create a game full of cool artwork and intricate details. This book is not an introductory guide to the Java programming language, but instead serves as an introduction to the field of game programming using Java. From the basics of creating simple Java programs and writing graphics code to utilizing Java?s advanced 2D library and adding sound effects and music, this book?s step-by-step instructions will help you acquire all the skills you need to create a professional-quality, sprite-based game.

Author Biography

Jonathan S. Harbour is a senior instructor of game development at the University of Advancing Technology in Tempe, Arizona

Table of Contents

Introduction xii
Part I: Java for Beginners
1(128)
Getting Started with Java 5
3(32)
What's New in Gaming?
3(4)
What's Old School?
6(1)
The Casual Boom
7(4)
Casual Gamers
8(1)
Casual Games
8(3)
Let's Get to the Point: Java
11(13)
No Experience Required
12(1)
Development Tools
13(2)
Installing the Latest JDK
15(4)
Version Numbers and Revision Woes
19(2)
Compiling from the Command Line
21(3)
Writing Your First Java Program
24(9)
The DrinkJava Program
24(1)
The Appletizer Program
25(8)
What You Have Learned
33(1)
Review Questions
33(1)
On Your Own
33(2)
Java Programming Essentials
35(26)
Java Applets
35(4)
Web Server Technology Explained
36(2)
Hosting Java Applets
38(1)
The Java Language
39(20)
Java Data Types
40(10)
The Essence of Class
50(1)
The main Function
51(1)
Object-Oriented Programming
52(7)
What You Have Learned
59(1)
Review Questions
60(1)
On Your Own
60(1)
Keyboard and Mouse Input
61(20)
Listening to the User
62(1)
Keyboard Input
62(11)
Listening for Keyboard Events
62(2)
Testing Keyboard Input
64(6)
Displaying Key Presses
70(3)
Mouse Input
73(6)
Reading Mouse Motion
73(1)
Detecting Mouse Buttons
74(1)
Testing Mouse Input
75(4)
What You Have Learned
79(1)
Review Questions
80(1)
On Your Own
80(1)
Sound Effects and Music
81(22)
Playing Digital Sample Files
81(12)
Getting Started with Java Sound
82(9)
Playing Sounds
91(2)
Playing MIDI Sequence Files
93(2)
Loading a MIDI File
93(1)
Playing Music
94(1)
Reusable Classes
95(6)
The SoundClip Class
96(3)
The MidiSequence Class
99(2)
What You Have Learned
101(1)
Review Questions
102(1)
On Your Own
102(1)
Creating Your First Java Game
103(26)
About the Game Project
103(3)
Creating the Game
106(20)
Creating the Project in JBuilder
107(1)
The BaseVectorShape Class
107(2)
The Ship Class
109(1)
The Bullet Class
110(1)
The Asteroid Class
111(1)
The Main Source Code File
112(14)
What You Have Learned
126(1)
Review Questions
127(1)
On Your Own
127(2)
Part II: Java 2-D Game Programming
129(198)
Java 2-D---Vector Graphics and Bitmaps
131(16)
Programming Vector Graphics
131(9)
Working with Shapes
132(2)
Working with Polygons
134(3)
Rotating and Scaling Shapes
137(3)
Programming Bitmapped Graphics
140(5)
Loading and Drawing Images
141(2)
Applying Transforms to Images
143(2)
What You Have Learned
145(1)
Review Questions
145(1)
On Your Own
146(1)
The Game Loop, Timing, and Threads
147(32)
The Potency of a Game Loop
147(9)
A Simple (Dead) Loop
148(2)
Adding Some Interaction
150(2)
Overriding Some Default Applet Behaviors
152(2)
Feeling Loopy
154(2)
Recovering Long-Lost Applet Methods
156(1)
Stepping Up to Threads
156(6)
Starting and Stopping the Thread
157(1)
The ThreadedLoop Program
157(4)
Examining Multi-Threading
161(1)
Building the Galactic War Game
162(14)
Changing the Base Class
163(2)
Generalizing the Vector Classes
165(2)
The ImageEntity Class
167(3)
The Main Source Code File: GalacticWar.java
170(6)
What You Have Learned
176(1)
Review Questions
177(1)
On Your Own
177(2)
Basic 2-D Actors---The Infamous ``Sprite''
179(40)
Drawing (More) Images
179(12)
Bitmap File Loader---Revisited
180(1)
Opaque Images
180(3)
Transparent Images
183(2)
Working Some Masking Magic
185(6)
Using Sprites
191(7)
The Point2D Class
193(5)
Enhancing Galactic War
198(18)
The New Galactic War Bitmaps
199(2)
The New and Improved Source Code
201(15)
What You Have Learned
216(1)
Review Questions
216(1)
On Your Own
217(2)
Advanced Sprite Programming---Animation
219(22)
Sprite Animation
219(13)
Animation Techniques
219(2)
Drawing Individual Frames
221(1)
Keeping Track of Animation Frames
222(1)
Testing Sprite Animation
223(4)
Encapsulating Sprite Animation in a Class
227(3)
Testing the AnimatedSprite Class
230(2)
Enhancing Galactic War
232(6)
What You Have Learned
238(1)
Review Questions
238(1)
On Your Own
239(2)
Creating a Java Game Framework
241(40)
Adjusting to Event-Driven Programming
242(12)
Exploring the Class Library
242(1)
Building the Game Class
243(11)
Enhancing Galactic War
254(25)
Exploring the New Galactic War Source Code
255(24)
What You Have Learned
279(1)
Review Questions
279(1)
On Your Own
280(1)
Enhancing and Polishing Galactic War
281(34)
Let's Talk About Powerups
281(5)
Ship and Bonus Point Powerups
282(1)
Weapon Upgrades
283(3)
Enhancing Galactic War
286(26)
New Sprite Types
286(1)
New Game States
287(1)
New Sprite Images
288(1)
Health/Shield Meters, Score, Firepower, and Game State Variables
289(1)
New Input Keys
289(1)
Sound and Music Objects
289(1)
Loading Media Files
290(2)
Game State Issue---Resetting the Game
292(1)
Detecting the ``Game Over'' State
293(1)
Screen Refresh Updates
294(3)
Preparing to End
297(1)
Updating New Sprites
297(2)
Grabbing Powerups
299(3)
New Input Keys
302(2)
Spawning Powerups
304(2)
Making the Shield Work
306(2)
Making Use of Weapon Upgrade Powerups
308(3)
Tallying the Score
311(1)
What You Have Learned
312(1)
Review Questions
312(1)
On Your Own
313(2)
Deploying Java Games on the Web
315(12)
Packaging an Applet in a Java Archive (JAR)
315(6)
Using the jar.exe Program
316(2)
Packaging Galactic War in a Java Archive
318(3)
Creating an HTML Host File for Your Applet
321(4)
A Simple HTML File
321(2)
Testing the Deployed Applet Game
323(2)
Epilogue
325(1)
What You Have Learned
325(1)
Review Questions
325(2)
Part III: Appendices
327(2)
Appendix A Chapter Quiz Answers
329(10)
Chapter 1
329(1)
Chapter 2
330(1)
Chapter 3
331(1)
Chapter 4
331(1)
Chapter 5
332(1)
Chapter 6
333(1)
Chapter 7
334(1)
Chapter 8
334(1)
Chapter 9
335(1)
Chapter 10
336(1)
Chapter 11
337(1)
Chapter 12
338(1)
Appendix B Recommended Books and Web Sites
339(7)
Support on the Web
339(1)
Game Development and Programming
340(1)
News, Reviews, and Download Sites
341(1)
Engines
341(1)
Independent Game Developers
341(1)
Industry
342(1)
Computer Humor
342(1)
Noteworthy Books
343(3)
Index 346

Supplemental Materials

What is included with this book?

The New copy of this book will include any supplemental materials advertised. Please check the title of the book to determine if it should include any access cards, study guides, lab manuals, CDs, etc.

The Used, Rental and eBook copies of this book are not guaranteed to include any supplemental materials. Typically, only the book itself is included. This is true even if the title states it includes any access cards, study guides, lab manuals, CDs, etc.

Rewards Program