Example usage for com.badlogic.gdx.math Vector2 epsilonEquals

List of usage examples for com.badlogic.gdx.math Vector2 epsilonEquals

Introduction

In this page you can find the example usage for com.badlogic.gdx.math Vector2 epsilonEquals.

Prototype

@Override
    public boolean epsilonEquals(Vector2 other, float epsilon) 

Source Link

Usage

From source file:com.dongbat.game.util.MovementUtil.java

/**
 * Check entity has arrived to destination or not
 *
 * @param e entity that you want to check
 * @return true if entity has arrived/*from  w w w  . ja  v a 2s .  c o  m*/
 */
public static boolean hasArrived(Entity e) {
    UnitMovement ms = EntityUtil.getComponent(e.getWorld(), e, UnitMovement.class);
    Vector2 position = PhysicsUtil.getPosition(e.getWorld(), e);
    Vector2 intent = ms.getDirectionVelocity();
    return intent.epsilonEquals(position, Constants.GAME.EPSILON);
}

From source file:com.dongbat.invasion.util.MovementUtil.java

public static boolean hasArrived(Entity entity) {
    EnemyMovement enemyMovement = EntityUtil.getComponent(entity, EnemyMovement.class);
    Vector2 intent = enemyMovement.getIntent().cpy();
    Vector2 position = PhysicsUtil.getPosition(entity);
    intent.y = position.y;/*from  w  w w . j  a va  2 s.  c  o  m*/
    return position.epsilonEquals(intent, Constants.GAME.EPSILON);
}

From source file:com.sturdyhelmetgames.roomforchange.screen.GameScreen.java

License:Apache License

@Override
protected void updateScreen(float fixedStep) {
    processKeys();//from  w w  w  .j  av a  2 s .co m

    level.update(fixedStep);

    final Vector2 currentPiecePos = level.findCurrentPieceRelativeToMapPosition();
    if (!currentPiecePos.epsilonEquals(currentCamPosition, 0.1f)) {
        Tween.to(camera.position, Vector3Accessor.POSITION_XY, 0.7f)
                .target(currentPiecePos.x + 6f, currentPiecePos.y + 4f, 0f).ease(Quad.INOUT)
                .start(cameraTweenManager);
        currentCamPosition.set(currentPiecePos);
        level.moveToAnotherPieceHook();
    }
    camera.update();

    screenQuake.update(fixedStep);
    cameraTweenManager.update(fixedStep);
}