My problem is that as i am moving my player entity all my entities shift position by the reverse total of my player entities movement vector, However the only system to move things is my MovementSystem class which moves a entity by its own movement vector and is clamped by delta Time.


public class MovementSystem extends IteratingSystem

    private ComponentMapper<MovementComponent> movementComponentMap;
    private ComponentMapper<TransformComponent> posComponentMap;
    private ComponentMapper<DebugComponent> debugComponentMap;

    public MovementSystem()
        super(Family.all(MovementComponent.class,  TransformComponent.class,

        movementComponentMap = ComponentMapper.getFor(MovementComponent.class);
        posComponentMap = ComponentMapper.getFor(TransformComponent.class);
        debugComponentMap = ComponentMapper.getFor(DebugComponent.class);

    protected void processEntity(Entity entity, float deltaTime)
        TransformComponent pos = posComponentMap.get(entity);
        MovementComponent mov = movementComponentMap.get(entity);
        DebugComponent db = debugComponentMap.get(entity);

        pos.Position.x += mov.Velocity.x * deltaTime;
        pos.Position.y += mov.Velocity.y * deltaTime;


public class RenderSystem extends SortedIteratingSystem
    private ComponentMapper<TextureComponent> textureComponentMap;
    private ComponentMapper<TransformComponent> transformComponentMap;
    private ComponentMapper<DebugComponent> dbMap;

    SpriteBatch batch;
    OrthographicCamera camera;

    public RenderSystem(SpriteBatch batch)
        super(Family.all(TransformComponent.class, TextureComponent.class).get(), new RenderComparator(), 50);

        textureComponentMap = ComponentMapper.getFor(TextureComponent.class);
        transformComponentMap = ComponentMapper.getFor(TransformComponent.class);
        dbMap = ComponentMapper.getFor(DebugComponent.class);
        this.batch = batch;
        camera = new OrthographicCamera(CONST.FRUSTRUM_WIDTH, CONST.FRUSTRUM_HEIGHT);

    public void update(float deltaTime)

    public void processEntity(Entity entity, float deltaTime)
        TextureComponent tex = textureComponentMap.get(entity);
        TransformComponent pos = transformComponentMap.get(entity);
        DebugComponent db = dbMap.get(entity);

        batch.draw(tex.Texture, pos.Position.x - tex.TextureOrigin.x,
            pos.Position.y - tex.TextureOrigin.y,
            tex.TextureOrigin.x, tex.TextureOrigin.y,
            tex.Texture.getRegionWidth(), tex.Texture.getRegionHeight(),
            pos.Scale.x, pos.Scale.y,
            MathUtils.radiansToDegrees * pos.Rotation);

The full code can be found on my github profile

i have no idea what is happening. i have been over my code with a fine toothed comb and lots of console output and i just cannot find a reason for everything to be jumping by essentially the speed of the player. any thoughts or nudges in directions would be greatly appreciated

  • \$\begingroup\$ It would apper that the bug lies somewhere in my RenderSystem, if i import the RenderingSystem from the SuperJump demo the bug vanishes. Ill investigate further and post an answer once i work it out \$\endgroup\$ Jan 10, 2016 at 23:53

1 Answer 1


My bug lies in the method of Vector2, Vector2.Zero. All of my Entities were using Vector2.Zero for their origin which turns out to be the same Vector2 object so changing one changed all the rest, The bug disappeared by giving my entities new Vector2 and not just reusing the same Vector2 returned from Vector2.Zero

  • \$\begingroup\$ This. Make sure to never use Vector2.Zero for variable initialization. \$\endgroup\$
    – Sebastian
    Oct 13, 2019 at 14:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .