Error - The operator * is undefined for the argument type(s) boolean, float

I have a class AlienPod:

public class AlienPod {
  public Globals globals = new Globals();

  public float xPos, yPos;
  public float Width, Height;
  public float travelDistance;

  public boolean isActive = false;

  public AlienPod (float xin, float yin, float travelin) {
    xPos = xin;
    yPos = yin;
    travelDistance = travelin;

    Width = globals.alienIcon.width;
    Height = globals.alienIcon.height;
  }

  public void activate () {
    this.isActive = true;
  }

  public void deactivate () {
    this.isActive = false;
  }

  public void moveToward (float towardX, float towardY) {
    this.xPos = this.xPos + (( this.xPos < towardX ) * this.travelDistance ) - (( this.xPos > towardX ) * this.travelDistance );
    this.yPos = this.yPos + (( this.yPos < towardY ) * this.travelDistance ) - (( this.yPos > towardY ) * this.travelDistance );
  }

}

However an error occurs at

this.xPos = this.xPos + (( this.xPos < towardX ) * this.travelDistance ) - (( this.xPos > towardX ) * this.travelDistance );

All data types appear to be float, so I'm lost.

Thanks

Tagged:

Answers

Sign In or Register to comment.