src/engine/systems/Motion.java
@Override
    public void execute(double time) {
        for (int pid : this.getActives()) {
            Map<String, Component> components = this.getHandled().get(pid);

            XVelocity vx = (XVelocity) components.get(XVelocity.KEY);
            YVelocity vy = (YVelocity) components.get(YVelocity.KEY);
            XPosition px = (XPosition) components.get(XPosition.KEY);
            YPosition py = (YPosition) components.get(YPosition.KEY);
            px.setData(px.getData() + vx.getData()*time);
            py.setData(py.getData() + vy.getData()*time);
        }
    }
/**
     * Apply changes in velocities to positions
     */
Apply changes in velocities to positions
Apply changes in velocities to positions
@Override
    public void execute(double time) {
        for (int pid : this.getActives()) {
            Map<String, Component> components = this.getHandled().get(pid);
            XVelocity vx = (XVelocity) components.get(XVelocity.KEY);
            YVelocity vy = (YVelocity) components.get(YVelocity.KEY);
            XPosition px = (XPosition) components.get(XPosition.KEY);
            YPosition py = (YPosition) components.get(YPosition.KEY);
            px.setData(px.getData() + vx.getData()*time);
            py.setData(py.getData() + vy.getData()*time);
        }
    }
@ Override public void execute ( double time ) { for ( int pid : this . getActives ( ) ) { Map < String , Component > components = this . getHandled ( ) . get ( pid ) ; XVelocity vx = ( XVelocity ) components . get ( XVelocity . KEY ) ; YVelocity vy = ( YVelocity ) components . get ( YVelocity . KEY ) ; XPosition px = ( XPosition ) components . get ( XPosition . KEY ) ; YPosition py = ( YPosition ) components . get ( YPosition . KEY ) ; px . setData ( px . getData ( ) + vx . getData ( ) * time ) ; py . setData ( py . getData ( ) + vy . getData ( ) * time ) ; } }
Apply changes in velocities to positions
Apply changes in velocities to positions