Presentation is loading. Please wait.

Presentation is loading. Please wait.

Building Memory… Day 5 – November 27, 2006. Need to flip cards Create a remove method to remove from drawing canvas Call a show method to show on the.

Similar presentations


Presentation on theme: "Building Memory… Day 5 – November 27, 2006. Need to flip cards Create a remove method to remove from drawing canvas Call a show method to show on the."— Presentation transcript:

1 Building Memory… Day 5 – November 27, 2006

2 Need to flip cards Create a remove method to remove from drawing canvas Call a show method to show on the drawing canvas Change state – wait we need a reference to a card to change its state

3 Slight redesign Put a method in the Card class called flip that takes care of calling the remove, show, and state transitioning.

4 Cards Flip! YEAH!

5 We need more cards If we create two, they are on top of each other. Need to be able to specify where a card should go – pass it in as a parameter perhaps.

6 Card Size will be a problem How big should the cards be? We should put values like this as a constant in our game. We can put them in an interface and have classes implement that interface to gain access to the value.

7 Constants Interface Only has values in it, no methods necessarily To create a constant in the interface, it is declared to be: –public (We’ve seen this before) –static (If something is static, you do not need to create an instance of the class it is in to access it) –final (Means it can not change)

8 How many cards Well, how many rows and columns do you want? Pass that in as a parameter to the game. Need to create that many cards

9 Suggestion Use a loop to create the correct number of cards

10 Question What’s a loop?


Download ppt "Building Memory… Day 5 – November 27, 2006. Need to flip cards Create a remove method to remove from drawing canvas Call a show method to show on the."

Similar presentations


Ads by Google