D Graphics and Animation

KEY TOPICS

  • Full-Screen Graphics
  • Images
  • Getting Rid of Flicker and Tearing
  • Simple Effects
  • Summary

First off, you can create three types of graphical games in Java: an applet game, a windowed game, and a full-screen game.

  • Applet games. Java applet games are apps that run in a web browser. The benefit here is that the user doesn't have to install anything. But players have to be online and running a web browser to play, and, unfortunately, applets have a few security restrictions to keep malicious code from causing harm. For example, applets can't save information such as preferences or saved games to the user's hard drive. Also, an applet can make a network connection only to the server that it came from.
  • Windowed games. Windowed Java games don't have the security restrictions that applets do. In fact, they look and behave like a normal app, with a title bar, a close button, and so on. However, these user interface elements can be distracting to the player, especially when you want players to become immersed in your game.
  • Full-screen games. Full-screen Java games give you total control over the visual presentation on your game, with no desktop user interface elements such as title bars, task bars, or docks. The player can become completely immersed in your game.

For these reasons, full-screen games are the focus of this tutorial. In this chapter, we cover full-screen graphics, animation, and sprites. Because we haven't talked about keyboard or mouse input yet (that's in the next chapter, "Interactivity and User Interfaces"), in this chapter you create short graphical demos.

Screenshot


   
Comments