Skip to content
Snippets Groups Projects
Select Git revision
  • 92be2984190bb2802832f8d2b4c22ed125163b72
  • master default
2 results

PongApp.java

Blame
  • Forked from LABOUREL Arnaud / Game engine template
    Source project has a limited visibility.
    Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    PongApp.java 1.41 KiB
    package pong;
    
    import engine.Coordinates2D;
    import engine.Grid;
    import engine.ImageComponent;
    import engine.Kernel;
    import sprint2_demo.Hero;
    
    import java.io.IOException;
    import java.util.ArrayList;
    
    public class PongApp {
    
        public static ArrayList<PongObject> components = new ArrayList<PongObject>();
        public static int width = 850;
        public static int height = 500;
    
        public PongApp() throws IOException {
        }
    
        public static void main(String[] args) throws IOException {
    
            PongRacket leftRacket = new PongRacket("Left racket", "src/main/resources/pong/raquette1.png", new Coordinates2D(5, 100), 30, 120);
            components.add(leftRacket);
    
            PongRacket rightRacket = new PongRacket("Right racket", "src/main/resources/pong/raquette2.png", new Coordinates2D(815, 100), 30, 120);
            components.add(rightRacket);
    
            // TODO: Add rackets
            PongBall pongBall = new PongBall("Ball", "src/main/resources/sprint2_demo/asteroid.png", new Coordinates2D(100, 10), 64, 64);
            components.add(pongBall);
    
            Grid grid = new Grid(); // Will create a new grid and a new kernel
            grid.init("Pong", width, height); // Will start the kernel and set the keys listeners
            while(true){
                try {
                    grid.kernel.update();
                    Thread.sleep(10);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        }
    }