You are previewing Beginning Java SE 6 Game Programming, Third Edition.

Beginning Java SE 6 Game Programming, Third Edition

Cover of Beginning Java SE 6 Game Programming, Third Edition by Jonathan S. Harbour Published by Course Technology PTR
  1. Copyright
    1. Dedication
  2. Acknowledgments
  3. About the Author
  4. Introduction
    1. What Will You Learn in This Book?
    2. What about the Programming Language?
    3. What IDE Should You Use?
    4. Conventions Used in This Book
    5. Companion Web Site Downloads
  5. I. Java for Beginners
    1. 1. Getting Started with Java
      1. Java and the Web
      2. The Casual Games Market
      3. Installing and Configuring Java
      4. Your First Java Program
      5. What You Have Learned
      6. Review Questions
      7. On Your Own
    2. 2. Java Programming Essentials
      1. Java Applets and Applications
      2. The Java Language
      3. The Essence of Class
      4. What You Have Learned
      5. Review Questions
      6. On Your Own
    3. 3. Creating Your First Java Game
      1. About the Game Project
      2. Creating the Game
      3. What You Have Learned
      4. Review Questions
      5. On Your Own
  6. II. Java Game Programming
    1. 4. Vector-Based Graphics
      1. Programming Vector Graphics
      2. What You Have Learned
      3. Review Questions
      4. On Your Own
    2. 5. Bitmap-Based Graphics
      1. Programming Bitmapped Graphics
      2. Transparency
      3. What You Have Learned
      4. Review Questions
      5. On Your Own
    3. 6. Simple Sprites
      1. Programming Simple Sprites
      2. Creating a Reusable Sprite Class
      3. What You Have Learned
      4. Review Questions
      5. On Your Own
    4. 7. Sprite Animation
      1. Sprite Animation
      2. What You Have Learned
      3. Review Questions
      4. On Your Own
    5. 8. Keyboard and Mouse Input
      1. Listening to the User
      2. Keyboard Input
      3. Mouse Input
      4. What You Have Learned
      5. Review Questions
      6. On Your Own
    6. 9. Sound Effects and Music
      1. Playing Digital Sample Files
      2. Playing MIDI Sequence Files
      3. Reusable Classes
      4. What You Have Learned
      5. Review Questions
      6. On Your Own
    7. 10. Timing and the Game Loop
      1. The Potency of a Game Loop
      2. Stepping Up to Threads
      3. What You Have Learned
      4. Review Questions
      5. On Your Own
  7. III. The Galactic War Project
    1. 11. Galactic War: From Vectors to Bitmaps
      1. Improving the Game
      2. What You Have Learned
      3. Review Questions
      4. On Your Own
    2. 12. Galactic War: Sprites and Collision Boxes
      1. Creating the Project
      2. What You Have Learned
      3. Review Questions
      4. On Your Own
    3. 13. Galactic War: Squashed by Space Rocks
      1. Being Civilized about Collisions
      2. What You Have Learned
      3. Review Questions
      4. On Your Own
    4. 14. Galactic War: Entity Management
      1. Adjusting to Event-Driven Programming
      2. Enhancing Galactic War
      3. What You Have Learned
      4. Review Questions
      5. On Your Own
    5. 15. Galactic War: Finishing the Game
      1. Let’s Talk about Power-Ups
      2. Enhancing Galactic War
      3. What You Have Learned
      4. Review Questions
      5. On Your Own
    6. 16. Galactic War: Web Deployment
      1. Packaging an Applet in a Java Archive (JAR)
      2. Creating an HTML Host File for Your Applet
      3. What You Have Learned
      4. Review Questions
      5. Epilogue
  8. Chapter Quiz Answers
    1. Chapter 1
    2. Chapter 2
    3. Chapter 3
    4. Chapter 4
    5. Chapter 5
    6. Chapter 6
    7. Chapter 7
    8. Chapter 8
    9. Chapter 9
    10. Chapter 10
    11. Chapter 11
    12. Chapter 12
    13. Chapter 13
    14. Chapter 14
    15. Chapter 15
    16. Chapter 16
O'Reilly logo

Chapter 10. Timing and the Game Loop

You have learned how to use the Graphics2D class to program graphics using vector shapes and bitmap images, and you have even seen a nearly complete game written from scratch. You have learned how to load and play sound files and MIDI music files, and how to program the keyboard and mouse. By all accounts, you have the tools to create many different games already. But there are some tricks of the trade—secrets of the craft—that will help you to make your games stand out in the crowd and impress. This chapter discusses the game loop and its vital importance to a smooth-running game. You will learn about threads and timing, and you will take the Asteroids-style game created in Chapters 3 and 5 into completely ...

The best content for your career. Discover unlimited learning on demand for around $1/day.