mercredi 4 novembre 2015

I cant figure out why my if statement isnt working

I am trying to figure out if my object is being hit, with a little leniance. But it doesnt want to work. Here is my code:

public boolean isClicked(float x) {

    if (Gdx.input.isTouched() && Gdx.graphics.getHeight() - Gdx.input.getY() >= this.getY() && Gdx.graphics.getHeight() - Gdx.input.getY() <= this.getY() + this.getHeight() && this.getWidth() >= Gdx.input.getX() && x < this.getY() + this.getHeight() * 1.2f && x > this.getY() - this.getHeight() * .2f) {
        return true;
    }

    return false;

Thanks!

Aucun commentaire:

Enregistrer un commentaire