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