Search in sources :

Example 6 with CoreEntity

use of com.ilargia.games.entitas.core.CoreEntity in project Entitas-Java by Rubentxu.

the class MoveSystem method execute.

@Override
public void execute(float deltatime) {
    for (CoreEntity e : _group.getEntities()) {
        Motion motion = e.getMotion();
        View view = e.getView();
        if (view.shape instanceof Rectangle) {
            Rectangle ret = (Rectangle) view.shape;
            ret.setPosition(ret.x + motion.velocity.x * Gdx.graphics.getDeltaTime(), ret.y + motion.velocity.y * Gdx.graphics.getDeltaTime());
        } else {
            Circle circle = (Circle) view.shape;
            circle.setPosition(circle.x + motion.velocity.x * Gdx.graphics.getDeltaTime(), circle.y + motion.velocity.y * Gdx.graphics.getDeltaTime());
        }
    }
}
Also used : CoreEntity(com.ilargia.games.entitas.core.CoreEntity) Motion(com.ilargia.games.logicbrick.component.Motion) Circle(com.badlogic.gdx.math.Circle) Rectangle(com.badlogic.gdx.math.Rectangle) View(com.ilargia.games.logicbrick.component.View)

Aggregations

CoreEntity (com.ilargia.games.entitas.core.CoreEntity)6 Circle (com.badlogic.gdx.math.Circle)4 Motion (com.ilargia.games.logicbrick.component.Motion)4 View (com.ilargia.games.logicbrick.component.View)4 Rectangle (com.badlogic.gdx.math.Rectangle)2 Player (com.ilargia.games.logicbrick.component.Player)2 Score (com.ilargia.games.logicbrick.component.Score)2 PongGame (com.ilargia.games.entitas.PongGame)1 IExecuteSystem (com.ilargia.games.entitas.api.system.IExecuteSystem)1 CoreContext (com.ilargia.games.entitas.core.CoreContext)1 CoreMatcher (com.ilargia.games.entitas.core.CoreMatcher)1 ChangeStateCommand (com.ilargia.games.entitas.egdx.api.ChangeStateCommand)1 Group (com.ilargia.games.entitas.group.Group)1 Delay (com.ilargia.games.logicbrick.component.Delay)1 TextureView (com.ilargia.games.logicbrick.component.TextureView)1