Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public boolean distributeWawes(Iterator<ArrayDeque<YX>> iter){
- if(waves.isEmpty())
- return false;
- while(iter.hasNext()){
- ArrayDeque<YX> arr = iter.next(); //ERROR
- if(arr.getLast().x == Level.player.x && arr.getLast().y == Level.player.y){
- yx = arr;
- return true;
- }
- if(mapYX[arr.getLast().y-1][arr.getLast().x] == 0){
- temp = arr;
- temp.addLast(new YX(arr.getLast().y-1,arr.getLast().x));
- tempWaves.add(temp);
- mapYX[arr.getLast().y-1][arr.getLast().x] = 1;
- }
- if(mapYX[arr.getLast().y][arr.getLast().x+1] == 0){
- temp = arr;
- temp.addLast(new YX(arr.getLast().y,arr.getLast().x+1));
- tempWaves.add(temp);
- mapYX[arr.getLast().y][arr.getLast().x+1] = 1;
- }
- if(mapYX[arr.getLast().y+1][arr.getLast().x] == 0){
- temp = arr;
- temp.addLast(new YX(arr.getLast().y+1,arr.getLast().x));
- tempWaves.add(temp);
- mapYX[arr.getLast().y+1][arr.getLast().x] = 1;
- }
- if(mapYX[arr.getLast().y][arr.getLast().x-1] == 0){
- temp = arr;
- temp.addLast(new YX(arr.getLast().y,arr.getLast().x-1));
- tempWaves.add(temp);
- mapYX[arr.getLast().y][arr.getLast().x-1] = 1;
- }
- }
- waves = tempWaves;
- return distributeWawes(waves.iterator());
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement