Advertisement
Guest User

Untitled

a guest
Nov 28th, 2014
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.73 KB | None | 0 0
  1.  
  2.  
  3. import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
  4.  
  5. import java.util.*;
  6.  
  7. import org.jdom2.Document;
  8. import org.jdom2.input.SAXBuilder;
  9.  
  10. /**
  11. * Write a description of class strand here.
  12. *
  13. * @author (your name)
  14. * @version (a version number or a date)
  15. */
  16. public class strand extends World
  17. {
  18. Document xml;
  19.  
  20. /**
  21. * Constructor for objects of class strand.
  22. *
  23. */
  24. public strand()
  25. {
  26. // Create a new world with 600x400 cells with a cell size of 1x1 pixels.
  27. super(1020,600, 1);
  28. prepare();
  29. }
  30.  
  31. private void createXML()
  32. {
  33. try
  34. {
  35. Document theXMLDoc = new SAXBuilder().build("xmldata/Chilledkroete.xml");
  36. this.xml = theXMLDoc;
  37. }
  38. catch (Exception e)
  39. {
  40.  
  41. }
  42.  
  43.  
  44. }
  45.  
  46.  
  47.  
  48. /**
  49. * Bereite die Welt für den Programmstart vor. Das heißt: Erzeuge die Anfangs-
  50. * Objekte und füge sie der Welt hinzu.
  51. */
  52. private void prepare()
  53. {
  54.  
  55. chilldkroete chilldkroete = new chilldkroete();
  56. addObject(chilldkroete, 100, 570);
  57. chilldkroete.setLocation(90, 569);
  58. chilldkroete.setLocation(91, 569);
  59. theRock therock = new theRock();
  60. addObject(therock, 178, 462);
  61. theRock therock2 = new theRock();
  62. addObject(therock2, 894, 466);
  63. theRock therock3 = new theRock();
  64. addObject(therock3, 183, 131);
  65. theRock therock4 = new theRock();
  66. addObject(therock4, 906, 130);
  67. theRock therock5 = new theRock();
  68. addObject(therock5, 316, 222);
  69. theRock therock6 = new theRock();
  70. addObject(therock6, 906, 288);
  71. theRock therock7 = new theRock();
  72. addObject(therock7, 277, 368);
  73. theRock therock8 = new theRock();
  74. addObject(therock8, 598, 130);
  75. theRock therock9 = new theRock();
  76. addObject(therock9, 484, 372);
  77. theRock therock10 = new theRock();
  78. addObject(therock10, 719, 465);
  79. theRock therock11 = new theRock();
  80. addObject(therock11, 705, 252);
  81. theRock therock12 = new theRock();
  82. addObject(therock12, 449, 189);
  83. theRock therock13 = new theRock();
  84. addObject(therock13, 26, 284);
  85. LobsterFeind lobsterfeind = new LobsterFeind();
  86. addObject(lobsterfeind, 389, 29);
  87. lobsterfeind.setRotation(90);
  88. LobsterFeind lobsterfeind2 = new LobsterFeind();
  89. addObject(lobsterfeind2, 818, 578);
  90. lobsterfeind2.setLocation(813, 573);
  91. lobsterfeind2.setRotation(-90);
  92.  
  93. Energydrink energydrink = new Energydrink();
  94. addObject(energydrink, 898, 385);
  95. energydrink.setLocation(896, 393);
  96. Energydrink energydrink2 = new Energydrink();
  97. addObject(energydrink2, 28, 213);
  98. Energydrink energydrink3 = new Energydrink();
  99. addObject(energydrink3, 292, 295);
  100. Energydrink energydrink4 = new Energydrink();
  101. addObject(energydrink4, 696, 183);
  102. lobsterfeind.setLocation(391, 133);
  103. therock12.setLocation(389, 49);
  104. therock5.setLocation(434, 506);
  105. therock5.setLocation(434, 506);
  106. therock5.setLocation(434, 506);
  107. therock5.setLocation(434, 506);
  108. therock5.setLocation(434, 506);
  109. therock5.setLocation(434, 506);
  110. therock5.setLocation(392, 598);
  111. lobsterfeind2.setLocation(807, 491);
  112. therock10.setLocation(719, 465);
  113. therock10.setLocation(719, 465);
  114. therock10.setLocation(719, 465);
  115. therock10.setLocation(801, 577);
  116. therock10.setLocation(807, 589);
  117. lobsterfeind2.setLocation(809, 511);
  118. therock6.setLocation(776, 90);
  119. therock6.setLocation(810, 42);
  120. therock12.setLocation(281, 217);
  121. lobsterfeind.setLocation(387, 91);
  122. therock5.setLocation(406, 520);
  123. lobsterfeind2.setLocation(813, 449);
  124. therock10.setLocation(681, 469);
  125. lobsterfeind2.setLocation(815, 537);
  126. therock6.setLocation(906, 322);
  127. therock6.setLocation(908, 320);
  128. therock5.setLocation(468, 246);
  129. therock9.setLocation(454, 504);
  130. therock9.setLocation(462, 510);
  131. therock5.setLocation(512, 316);
  132. Pelikan pelikan = new Pelikan();
  133. addObject(pelikan, 698, 328);
  134. pelikan.setLocation(672, 394);
  135. Pelikan pelikan2 = new Pelikan();
  136. addObject(pelikan2, 803, 228);
  137.  
  138.  
  139. }
  140.  
  141.  
  142. private void prepare2()
  143. {
  144. chilldkroete chilldkroete = new chilldkroete();
  145. addObject(chilldkroete, Greenfoot.getRandomNumber(1020),Greenfoot.getRandomNumber(600));
  146.  
  147.  
  148. }
  149. private void prepare3()
  150. {
  151. chilldkroete chilldkroete = new chilldkroete();
  152. addObject(chilldkroete, 40,40);
  153.  
  154. theRock theRock = new theRock();
  155. addObject(theRock,50,50);
  156.  
  157. LobsterFeind LobsterFeind = new LobsterFeind();
  158. addObject(LobsterFeind,60,60);
  159.  
  160.  
  161. }
  162. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement