lundi 22 août 2016

make each card only appear once, card game?

I am making a card game where each card should appear, but only once. I have seen some other solutions but cant seem to apply it to my Game.

            int max = 32;
            int min = 1;
            Random r = new Random();
            int number = r.nextInt(max - min + 1) + min;
            String myString = String.valueOf(number);

            final ImageView imgTable = (ImageView) findViewById(R.id.imageView2);

            if (myString.equals("1")) {

                final Bitmap card1 = BitmapFactory.decodeResource(getResources(), R.mipmap.herz7);
                imgTable.setImageBitmap(card1);
            }
            if (myString.equals("2")) {

                final Bitmap card2 = BitmapFactory.decodeResource(getResources(), R.mipmap.herz8);
                imgTable.setImageBitmap(card2);
            }




Aucun commentaire:

Enregistrer un commentaire