mirror of
https://github.com/collinsmith/riiablo.git
synced 2025-07-06 00:08:19 +07:00
Set cof speeds back to 136 delta -- still needs work on proper formula, but this is fine for now
This commit is contained in:
@ -4,8 +4,6 @@ import com.badlogic.ashley.core.ComponentMapper;
|
||||
import com.badlogic.ashley.core.Entity;
|
||||
import com.badlogic.ashley.core.Family;
|
||||
import com.badlogic.ashley.systems.IteratingSystem;
|
||||
import com.badlogic.gdx.math.MathUtils;
|
||||
import com.riiablo.codec.Animation;
|
||||
import com.riiablo.engine.Flags;
|
||||
import com.riiablo.engine.component.CofComponent;
|
||||
import com.riiablo.engine.component.MovementModeComponent;
|
||||
@ -29,19 +27,28 @@ public class MovementModeSystem extends IteratingSystem {
|
||||
cofComponent.mode = movementModeComponent.NU;
|
||||
cofComponent.speed = CofComponent.SPEED_NULL;
|
||||
} else {
|
||||
float velocity = velocityComponent.velocity.len();
|
||||
float fps;
|
||||
//float velocity = velocityComponent.velocity.len();
|
||||
//float fps;
|
||||
if ((entity.flags & Flags.RUNNING) == Flags.RUNNING) {
|
||||
fps = velocity * 5f;
|
||||
//fps = velocity * 5f;
|
||||
cofComponent.mode = movementModeComponent.RN; // each step = 2 yards
|
||||
//cofComponent.speed = 136;
|
||||
cofComponent.speed = 136;
|
||||
} else { // each step = 1 yards
|
||||
fps = velocity * 8f;
|
||||
//fps = velocity * 8f;
|
||||
cofComponent.mode = movementModeComponent.WL; // each step = 1 yards
|
||||
//cofComponent.speed = 136;
|
||||
cofComponent.speed = 136;
|
||||
}
|
||||
|
||||
cofComponent.speed = MathUtils.roundPositive(256f / (fps / Animation.FRAMES_PER_SECOND));
|
||||
/**
|
||||
* FIXME: below looks really close, still haven't figured it out though
|
||||
* I've tried calculating some proportion of velocity -- still a possibility
|
||||
* ... assuming each frame is 1/25 fps, so 12.5 frames would be 128 delta
|
||||
* best results so far seem to just be using 128 for everything -- but this doesn't
|
||||
* account for changes to velocity (faster movement should have faster animations)
|
||||
* it's 136 now because that looked a bit better than 128, but more testing is
|
||||
* needed once velocity can be modded past default (items, auras, etc)
|
||||
*/
|
||||
//cofComponent.speed = MathUtils.roundPositive((cofComponent.cof.getNumFramesPerDir() / Animation.FRAMES_PER_SECOND) * 256f);
|
||||
//System.out.println(velocity + " " + fps + " " + cofComponent.speed);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user