Advertisement
Guest User

Untitled

a guest
Jul 25th, 2014
242
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. if (w >=8 && w<=9){
  2. int randomX=(int)Math.round(Math.random()*(width-11)+4);
  3. int randomY=(int)Math.round(Math.random()*(height-11)+4);
  4. if (tiles[randomX][randomY]== Tile.DOOR){
  5. if (tiles[randomX+1][randomY]== Tile.FLOOR||tiles[randomX+1][randomY]== Tile.FIRSTFLOOR){
  6. randomX=randomX-3;
  7. }
  8. else if (tiles[randomX-1][randomY]== Tile.FLOOR||tiles[randomX-1][randomY]== Tile.FIRSTFLOOR){
  9. randomX=randomX+1;
  10. }
  11. else break;
  12. int z=0;
  13. for (int x =0;x<3;x++){
  14. for (int y=0; y<1;y++){
  15. if (tiles[randomX+x][randomY+y] == Tile.WALL){
  16. z++;
  17. }
  18. }
  19. }
  20. if (z==3){
  21. for (int x =0;x<3;x++){
  22. for (int y=0; y<1;y++){
  23. tiles[randomX+x][randomY+y] = Tile.FLOOR;
  24. }
  25. }
  26. tiles[randomX+3][randomY]= Tile.DOOR;
  27. tiles[randomX-1][randomY]= Tile.DOOR;
  28. tiles[randomX+1][randomY-1]= Tile.DOOR;
  29. tiles[randomX+1][randomY+1]= Tile.DOOR;
  30. }
  31. }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement