Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int srodek = 50;
- map[srodek][srodek] = 1;
- int dystans = 4; // dystans pomiędzy warstwami
- int warstwa = 1; // numer warstwy
- int bok = 1; // który z 4 boków kwadratu XD
- int startX = 0;
- int startY = 0;
- int endX = 0;
- int endY = 0;
- if (bok == 1) {
- startX = srodek - warstwa*dystans;
- startY = srodek - warstwa*dystans;
- endX = srodek + warstwa*dystans;
- endY = srodek - warstwa*dystans;
- }
- // itd.
- Random r = new Random();
- int coordinateX = r.nextInt(endX - startX) + startX;
- int coordinateY = r.nextInt(endY - startY) + startY;
- // while(userRepository.findByCoordinateXAndCoordinateY(coordinateX,coordinateY)!=null && fieldRepository.findByCoordinateXAndCoordinateY(coordinateX,coordinateY)!=null){
- // coordinateX = random.nextInt(100);
- // coordinateY = random.nextInt(100);
- // }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement