示例#1
0
  private void spawnAtacker(float x, float y) {
    this.ship = new LightFighter(this, x, y);
    ManagerActor.getInstance().addEntityNext(ship);
    ship.setTarget(target);
    ship.followTarget(true);

    ship.setLightColor(Color.RED);
    ship.toggleLights();
  }
示例#2
0
  public void setTarget(WorldObject target) {
    this.target = target;

    ship.setTarget(target);
    ship.followTarget(true);

    ship.setLightColor(Color.RED);
    ship.toggleLights();
  }
示例#3
0
  private void prepareShip() {

    ship = (Ship) WorldObjectPool.getInstance().reuse("Light-fighter");
    if (ship == null) {
      ship = new LightFighter(this, shipStartX, shipStartY);
      ManagerActor.getInstance().addEntityNext(ship);
    } else {
      ship.getBody().setTransform(shipStartX, shipStartY, ship.getBody().getAngle());
      ship.setShipController(this);
    }
  }
示例#4
0
  public void update(float delta) {

    if (shotDelay > 0) {
      shotDelay -= delta;
    } else if (shotDelay <= 0) {
      shotDelay = 0;
    }

    float distance = ship.getDistanceToTarget();
    if (distance <= 15 && distance > 0 && this.target != null && shotDelay == 0) {
      ship.shootMainGun();
      shotDelay = SHOT_DELAY;
    }
  }