I am trying to add 2 cards on dealer side and 2 on the player this is the code I have tried, the cards are random but only one will show one will show up on the screen each time.
and this just below
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | int l = Greenfoot.getRandomNumber( 3 ); int p = Greenfoot.getRandomNumber( 12 ); String picName; //string allows the values and suits to have a image assigned to them for ( int x = 0 ; x < 4 ; x++) { for ( int y = 0 ; y < 13 ; y++) { //the string must include suit card and png on the end to make it the same as the file in greenfoot images file //both lines call from the strings created above creating new lines for the addobject picName = suits[x] + cards[y] + ".png" ; Crd[x][y] = new Card(suits[x], cards[y], cardvalues[y], picName ); } } |
1 2 3 4 | for ( int i = 0 ; i <= 2 ; i++) { addObject(Crd[l][p], 220 , 500 ); } |