Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main;
- import java.io.File;
- import java.io.IOException;
- import javax.imageio.ImageIO;
- import entity.Dragon;
- import imageBuilders.Image;
- public class Main {
- public static JFrameBuilder jf ;
- public static void main(String[] args){
- jf = new JFrameBuilder("Tutorial");
- try {
- JCanvas.addImage(new Image(ImageIO.read(new File("C:/Users/Eddie/Desktop/testprog2/Tutorial game/src/imgs/Dragon.png")), null,100,100));
- JCanvas.addImage(new Image(ImageIO.read(new File("C:/Users/Eddie/Desktop/testprog2/Tutorial game/src/imgs/rocket.png")), null,100,100));
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- int x = 0;
- Dragon d = new Dragon(jf,x);
- while(jf.isActive()){
- jf.update(jf.getGraphics());
- JCanvas.changeImageXandY(d.calculateX(), d.calculateY(), 0);
- System.out.println(d.calculateX());
- delay(16);
- }
- }
- public static void delay(long ms){
- try {
- Thread.sleep(ms);
- } catch (InterruptedException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- }
Add Comment
Please, Sign In to add comment