Dive-Engine-2D/src/diveengine2d/RigidBody.java

18 lines
387 B
Java
Raw Normal View History

2016-02-16 03:42:12 -05:00
package diveengine2d;
public class RigidBody extends DiveScript{
public double dx, dy, drot;
public double friction;
2016-02-16 04:04:05 -05:00
2016-02-16 03:42:12 -05:00
public void update() {
entity.x += dx * Time.deltaTime;
entity.y += dy * Time.deltaTime;
entity.rotation += drot * Time.deltaTime;
double friction = 1 - ((1 - this.friction) * Time.deltaTime);
2016-02-16 04:48:35 -05:00
dx *= friction;
dy *= friction;
drot *= friction;
2016-02-16 03:42:12 -05:00
}
}