Search in sources :

Example 6 with Motion

use of com.ilargia.games.logicbrick.component.Motion in project Entitas-Java by Rubentxu.

the class CoreEntity method replaceMotion.

public CoreEntity replaceMotion(float x, float y) {
    Motion component = (Motion) recoverComponent(CoreComponentsLookup.Motion);
    if (component == null) {
        component = new Motion(x, y);
    } else {
        component.velocity = new Vector2(x, y);
    }
    replaceComponent(CoreComponentsLookup.Motion, component);
    return this;
}
Also used : Motion(com.ilargia.games.logicbrick.component.Motion) Vector2(com.badlogic.gdx.math.Vector2)

Aggregations

Motion (com.ilargia.games.logicbrick.component.Motion)6 CoreEntity (com.ilargia.games.entitas.core.CoreEntity)4 Circle (com.badlogic.gdx.math.Circle)3 View (com.ilargia.games.logicbrick.component.View)3 Vector2 (com.badlogic.gdx.math.Vector2)2 Player (com.ilargia.games.logicbrick.component.Player)2 Rectangle (com.badlogic.gdx.math.Rectangle)1 Score (com.ilargia.games.logicbrick.component.Score)1