Guest User

Main.class

a guest
Mar 7th, 2018
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. package main;
  2.  
  3. import java.io.File;
  4. import java.io.IOException;
  5.  
  6. import javax.imageio.ImageIO;
  7.  
  8. import entity.Dragon;
  9. import imageBuilders.Image;
  10.  
  11.  
  12. public class Main {
  13.  
  14. public static JFrameBuilder jf ;
  15.  
  16. public static void main(String[] args){
  17.  
  18. jf = new JFrameBuilder("Tutorial");
  19.  
  20.  
  21. try {
  22. JCanvas.addImage(new Image(ImageIO.read(new File("C:/Users/Eddie/Desktop/testprog2/Tutorial game/src/imgs/Dragon.png")), null,100,100));
  23. JCanvas.addImage(new Image(ImageIO.read(new File("C:/Users/Eddie/Desktop/testprog2/Tutorial game/src/imgs/rocket.png")), null,100,100));
  24. } catch (IOException e) {
  25. // TODO Auto-generated catch block
  26. e.printStackTrace();
  27. }
  28. int x = 0;
  29.  
  30. Dragon d = new Dragon(jf,x);
  31. while(jf.isActive()){
  32. jf.update(jf.getGraphics());
  33.  
  34. JCanvas.changeImageXandY(d.calculateX(), d.calculateY(), 0);
  35. System.out.println(d.calculateX());
  36. delay(16);
  37. }
  38. }
  39.  
  40.  
  41. public static void delay(long ms){
  42. try {
  43. Thread.sleep(ms);
  44. } catch (InterruptedException e) {
  45. // TODO Auto-generated catch block
  46. e.printStackTrace();
  47. }
  48. }
  49.  
  50.  
  51. }
Add Comment
Please, Sign In to add comment