O'Reilly logo

Android Game Programming For Dummies by Derek James

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 6

Creating a Basic Play Screen

In This Chapter

arrow Loading multiple images

arrow Handling logic, taking turns, and advancing the game

arrow Making a simple computer opponent

After the title screen is functional, it’s time to build the meat of the game — the play screen. You need images for each of the cards in the deck. I’ve provided the images for you in the digital resources. You can see how to load them in bulk, shuffle, and deal.

Picking up, moving, and dropping cards in the right spots are all important tasks, as is displaying the current game state. You’ll also implement a random AI to test against initially, and then refine it later to provide more of a challenge to players.

ontheweb_modern.eps You can download sample files for this chapter at

www.dummies.com/go/androidgameprogramming

Displaying Cards

To make your game realistic, players need to see the cards in their own hands and in the discard pile. This requires several steps of programming.

Loading the card images

Before you load the card images, you have to create a new class for cards. Follow these steps:

1. Right-click the package and then select ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required