fix: changed deltaTime to dt
This commit is contained in:
parent
9bc8b487ae
commit
80e2ffa8e3
|
@ -88,14 +88,14 @@ public class Arrow extends Actor {
|
|||
* Updates the physical attributes of the Arrow,
|
||||
* must be called in the main update loop.
|
||||
*
|
||||
* @param deltaTime time elapsed between 2 frames.
|
||||
* @param dt time elapsed between 2 frames.
|
||||
*/
|
||||
public void update(float deltaTime) {
|
||||
public void update(float dt) {
|
||||
|
||||
if (this.active) {
|
||||
verifyActivity();
|
||||
integrationVerlet(deltaTime);
|
||||
this.TTL -= deltaTime;
|
||||
integrationVerlet(dt);
|
||||
this.TTL -= dt;
|
||||
this.angle = this.velocity.angleDeg();
|
||||
} else {
|
||||
this.position = crash.position.cpy().add(offset);
|
||||
|
@ -107,20 +107,20 @@ public class Arrow extends Actor {
|
|||
* according to its physical attributes
|
||||
* using the Verlet integration scheme.
|
||||
*
|
||||
* @param deltaTime time difference used in the integration.
|
||||
* @param dt time difference used in the integration.
|
||||
* @see <a href="https://gamedev.stackexchange.com/a/41917">https://gamedev.stackexchange.com/a/41917</a>.
|
||||
*/
|
||||
private void integrationVerlet(float deltaTime) {
|
||||
private void integrationVerlet(float dt) {
|
||||
|
||||
this.acceleration = this.force.cpy();
|
||||
|
||||
this.position.x += deltaTime * ( this.velocity.x + deltaTime * this.acceleration.x / 2 );
|
||||
this.position.y += deltaTime * ( this.velocity.y + deltaTime * this.acceleration.y / 2 );
|
||||
this.position.x += dt * ( this.velocity.x + dt * this.acceleration.x / 2 );
|
||||
this.position.y += dt * ( this.velocity.y + dt * this.acceleration.y / 2 );
|
||||
|
||||
this.force = computeForce();
|
||||
|
||||
this.velocity.x += deltaTime * ( this.acceleration.x + this.force.x ) / 2;
|
||||
this.velocity.y += deltaTime * ( this.acceleration.y + this.force.y ) / 2;
|
||||
this.velocity.x += dt * ( this.acceleration.x + this.force.x ) / 2;
|
||||
this.velocity.y += dt * ( this.acceleration.y + this.force.y ) / 2;
|
||||
}
|
||||
|
||||
// ---------- GRAPHICAL METHODs ----------
|
||||
|
|
|
@ -34,7 +34,7 @@ class Bow extends Actor {
|
|||
// ---------- METHODs ----------
|
||||
|
||||
@Override
|
||||
public void act(float deltaTime) {
|
||||
public void act(float dt) {
|
||||
|
||||
if (Gdx.input.isButtonJustPressed(Buttons.LEFT) && !pressed) {
|
||||
this.anchor = Sagittarius.worldCursor.cpy();
|
||||
|
|
|
@ -20,7 +20,7 @@ public class Moon extends Planet {
|
|||
// ---------- METHODs ----------
|
||||
|
||||
@Override
|
||||
public void act(float deltaTime) {
|
||||
public void act(float dt) {
|
||||
|
||||
this.rotateBy(10.0f / this.altitude);
|
||||
|
||||
|
|
|
@ -41,13 +41,13 @@ public class Player extends Actor {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void act(float deltaTime) {
|
||||
super.act(deltaTime);
|
||||
public void act(float dt) {
|
||||
super.act(dt);
|
||||
|
||||
this.setX(home.getX() + this.home.getRadius()*MathUtils.cosDeg(this.getRotation()));
|
||||
this.setY(home.getY() + this.home.getRadius()*MathUtils.cosDeg(this.getRotation()));
|
||||
|
||||
//this.bow.act(deltaTime);
|
||||
//this.bow.act(dt);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -22,7 +22,7 @@ public abstract class BaseScreen implements Screen {
|
|||
@Override
|
||||
public void render(float dt) {
|
||||
|
||||
// update actors
|
||||
// update Stages
|
||||
uiStage.act(dt);
|
||||
mainStage.act(dt);
|
||||
|
||||
|
@ -43,8 +43,10 @@ public abstract class BaseScreen implements Screen {
|
|||
mainStage.dispose();
|
||||
}
|
||||
|
||||
// methods required by Screen interface
|
||||
@Override public void resize(int width, int height) {}
|
||||
@Override public void resize(int width, int height) {
|
||||
mainStage.getViewport().update(width, height, true);
|
||||
}
|
||||
|
||||
@Override public void pause() {}
|
||||
@Override public void resume(){}
|
||||
@Override public void show() {}
|
||||
|
|
|
@ -50,14 +50,10 @@ public class StartScreen extends BaseScreen {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void update(float deltaTime) {
|
||||
public void update(float dt) {
|
||||
//
|
||||
}
|
||||
|
||||
public void resize(int width, int height) {
|
||||
mainStage.getViewport().update(width, height, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
VisUI.dispose();
|
||||
|
|
Loading…
Reference in a new issue