Ejemplo n.º 1
0
  public Enemy(
      Vector2f pos,
      int texid,
      Controller parent,
      EnemyPath ep,
      Sprite player,
      ArrayList<EnemyBullet> playerbullets,
      String texloc,
      int lowesttexid,
      int highesttexid,
      int width,
      int pattern) {
    this.width = width / Display.getWidth();
    this.playerbullets = playerbullets;
    this.parent = parent;
    this.pattern = pattern;
    this.lti = lowesttexid;
    this.hti = highesttexid;
    this.pos =
        new Vector2f(((pos.x / Display.getWidth())), ((pos.y) / (Display.getHeight() / 2.0f)));
    this.playersprite = player;
    this.ep = ep;
    this.texid = texid;
    this.player = new Rectangle2D.Float();
    this.myrect = new Rectangle2D.Float();

    ImageReturn images = new ImageReturn();
    GridParser gp = new GridParser();
    TextureHolder texture;

    try {
      texture = gp.parseGrid(images.getImage("explosion.png"), 30);
      this.explosion =
          new Sprite(
              images.getImage("explosion.png"),
              parent,
              70,
              70,
              texture,
              0,
              new Vector2f(0.0f, 0.0f));
      texture = gp.parseGrid(images.getImage("bullets2.png"), 20);
      this.bullet =
          new Sprite(
              images.getImage("bullets2.png"),
              parent,
              40,
              40,
              texture,
              0,
              new Vector2f(0.0f, 0.0f));
      texture = gp.parseGrid(images.getImage(texloc), 50);
      me = new Sprite(images.getImage(texloc), parent, 100, 100, texture, 0, this.pos);
    } catch (IOException e) {
      System.err.println("err at enemy");
      System.exit(1);
      e.printStackTrace();
    }
  }
Ejemplo n.º 2
0
  public ScoreHandler(Controller parent, Player player) {
    ImageReturn images = new ImageReturn();
    GridParser gp = new GridParser();

    this.parent = parent;
    this.player = player;

    TextureHolder pellettex;
    try {
      pellettex = gp.parseGrid(images.getImage("score.png"), 20.0f);
      pellet =
          new Sprite(
              images.getImage("score.png"), parent, 50, 50, pellettex, 0, new Vector2f(0.0f, 0.0f));
    } catch (IOException e) {
      System.err.println("err at scrollhandler");
      e.printStackTrace();
    }
  }