Creating a Basic Play Screen
In This Chapter
Loading multiple images
Handling logic, taking turns, and advancing the game
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.
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 ...