Hello im making a memory game and in 1st difficulty level i want to spawn 4 cards randomly but in set location
300, 100
300, 400
600, 100
600, 400
and i been thinking how can i make sure that they wont going to spawn in the same place
This is my code in my word
LETTERS are one types of cards that will have to match with correct PICTURES array for example LetterA with Apple
i been trying to make array in to set up x and y location and make a random varible that will get random location from them
in while loop i been trying to check if first card x and y location are the same as in card 2 but its saying: cannot infer type-varribles A
if(difficulty==1) { int[] x={300, 600}; int[] y={100, 400}; int x1 = Greenfoot.getRandomNumber(2); int y1 = Greenfoot.getRandomNumber(2); if(card1==card1 && card1spawn == true) { addObject(LETTERS[card1], 300, 100); addObject(PICTURES[card1], 600, 400); card1spawn = false; } if(card2==card2 && card2spawn == true) { addObject(LETTERS[card2], 600, 100); addObject(PICTURES[card2], 300, 400); card2spawn = false; } while(getObjectsAt(x[x1], y[y1], LETTERS[card1]) == getObjectsAt(x[x1], y[y1], PICTURES[card1])) { } }