Esempio n. 1
0
  public void tick() {
    x += velX;
    y += velY;

    x = Game.clamp(x, 0, Game.WIDTH - 38);
    y = Game.clamp(y, 0, Game.HEIGHT - 60);
    handler.addObject(new Trail(x, y, ID.Trail, Color.white, 32, 32, 0.1f, handler));
    collision();
  }
Esempio n. 2
0
  private void init() {
    WIDTH = getWidth();
    HEIGHT = getHeight();

    handler = new Handler();

    handler.addObject(new Player(100, 100, handler, ObjectId.Player));

    handler.createLevel();

    this.addKeyListener(new KeyInput(handler));
  }
Esempio n. 3
0
  private void initObjects() {

    if (handler.objects.size() > 0) {
      handler.removeObject(handler.objects.get(0));
    }
    handler.addObject(
        new ShipV(
            WIDTH / 2,
            10,
            randomgen1.nextDouble() * 2 - 1,
            0,
            0,
            270,
            randomgen1.nextDouble() * 5,
            0,
            0,
            1));
    ;
    landingZone1 =
        new LandingZone(
            WIDTH / 2 + randomgen1.nextInt(WIDTH / 2) - WIDTH / 4,
            HEIGHT - randomgen1.nextInt(HEIGHT - 100),
            20);
  }