I need to create an app or game inside of an app that takes in (downloads) a set of pictures from a website online and uses those photos as the cards in a game of concentration. I’m just looking for suggestions or examples on the best way to go about doing this. Concentration is where you have a set of 8 or so cards, so 4 pairs. All of the cards are face down. You pick 2 at a time, and when you pick a pair, the pair stays up. If you do not pick a pair the cards are flipped back up.
i need a way to be able to recognize if the two ‘cards’ picked are a match.
I’m wanting to use a GridView to create a simple “Concentration” game with a board that is only 2×3.
Heres my first thoughts. use grid view to create a 2×3 grid. how do i make the GridView 2×3?
then place an ImageView into each grid spot. Can i do that?
Is it possible for an ImageView to hold two images and alternate between them? that would be great.
here is some ‘pseudo-code’ i just thought up:
int counter = 0;
boolean finished = false;
while(finished == false){
if(counter % 2 == 0){
pickFirstCard(); //store first pick and leave it facing up
}
else{
pickSecondCard();
compareCards(); //method to compare cards
}
counter++;
}
is there any way i can give ImageViews a ‘value’ or ‘attribute’ so that when i compare them i can use that to see if they are a match? or just use the image file name? thoughts?
Ill add more soon
I think you should use Data model to process your game logic and use UI to show the game logic.