Guest User

Untitled

a guest
May 20th, 2018
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.99 KB | None | 0 0
  1. import java.util.ArrayList;
  2. import java.util.List;
  3. import java.util.concurrent.atomic.AtomicReference;
  4.  
  5. class BoulderDash
  6. {
  7. // private static Element[][] array;
  8. private static Player player;
  9. private static GUI gui;
  10. private static Element[][] field1;
  11. private static Boulder boulder;
  12. private static Monster monster;
  13. private static int roundCount;
  14.  
  15.  
  16.  
  17. public static void main(String[] args)
  18. {
  19. List<List<String>> fields = MapProvider.loadMaps();
  20. MapParser mapParser = new MapParser();
  21. AtomicReference<Player> ref = new AtomicReference<Player>();
  22. field1 = mapParser.parseMap(fields.get(0),ref);
  23. player = ref.get();
  24.  
  25. gui = new GUI();
  26. gui.setLevel(1, field1);
  27. //PlayerMovement();
  28.  
  29. roundCount = 0;
  30.  
  31. while(player.isAlive())
  32. {
  33.  
  34. GUI.Key key = gui.step();
  35.  
  36. player.setKey(key);
  37. player.performTurn();
  38. gui.update(field1, player.getScore());
  39.  
  40. if (roundCount == 10)
  41. {
  42. for(int i = mapParser.getLine()-1; i >= 0; i--)
  43. {
  44. for(int j = mapParser.getColumn()-1; j >= 0; j--)
  45. {
  46. field1[i][j].performTurn();
  47. gui.update(field1, player.getScore());
  48. }
  49. }
  50.  
  51. roundCount = 0;
  52. }
  53.  
  54. roundCount++;
  55. }
  56.  
  57.  
  58.  
  59.  
  60. }
  61.  
  62.  
  63.  
  64.  
  65.  
  66. /* public static void PlayerMovement ()
  67. {
  68. while(player.isAlive())
  69. {
  70. GUI.Key key = gui.step();
  71. player.setKey(key);
  72. player.performTurn();
  73. gui.update(field1, player.getScore());
  74. }
  75.  
  76. } */
  77.  
  78.  
  79.  
  80.  
  81.  
  82. }
Add Comment
Please, Sign In to add comment