Presentation is loading. Please wait.

Presentation is loading. Please wait.

Building Memory… Day 7 – April 18, 2007. Mouse Listener Attached listeners to each card (but the back image only) When click event is generated, simply.

Similar presentations


Presentation on theme: "Building Memory… Day 7 – April 18, 2007. Mouse Listener Attached listeners to each card (but the back image only) When click event is generated, simply."— Presentation transcript:

1 Building Memory… Day 7 – April 18, 2007

2 Mouse Listener Attached listeners to each card (but the back image only) When click event is generated, simply remove the back of the card from the drawing canvas and put the front of the card on the canvas

3 Viola Clicking works Since listener not attached to the front, further clicks will not be recognized.

4 State Design Pattern The game can be in three distinct states (zero cards face up, one card face up, and two cards face up). Once we have two cards face up, we don’t want clicks to be recognized and no more cards should flip over

5 State Design Pattern Create a state object for each of the states. State transition for the game happens when the user clicks.

6 Viola Now, we can not click on more than two images. We need to think about how to test for “matching” images.


Download ppt "Building Memory… Day 7 – April 18, 2007. Mouse Listener Attached listeners to each card (but the back image only) When click event is generated, simply."

Similar presentations


Ads by Google