rotation
Marcus Gosselin 2016-02-16 04:04:05 -05:00
parent e289f1a5ff
commit 70b234f156
2 changed files with 12 additions and 2 deletions

View File

@ -65,10 +65,12 @@ public class Engine extends Canvas {
bs = getBufferStrategy();
while(true) {
long startTime = System.currentTimeMillis();
updateScene();
repaint();
int elapsed = (int)(System.currentTimeMillis() - startTime);
try{
Thread.sleep(17);
Thread.sleep(16 - elapsed);
}catch(Exception e) {
}

View File

@ -2,7 +2,15 @@ package diveengine2d;
public class RigidBody extends DiveScript{
public float dx, dy, drot;
public float friction = 0.99f;
public void update() {
entity.x += dx;
entity.y += dy;
entity.rotation += drot;
dx *= .3;
dy *= .3;
drot *= .3;
}
}