Skip to content

Commit

Permalink
fix($gameplay): slow motion
Browse files Browse the repository at this point in the history
  • Loading branch information
cstuncsik committed Sep 24, 2016
1 parent d3ffeea commit a8e0611
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
8 changes: 3 additions & 5 deletions examples/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,10 @@
});

function input() {
if(mouseDown){
velocity *= 1.0005;
direction = 1;
if (mouseDown) {
loop.setSlow(3);
} else {
velocity /= 1.0005;
direction = -1;
loop.setSlow(1);
}
}

Expand Down
6 changes: 2 additions & 4 deletions examples/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,9 @@ requirejs(['../src/gameLoop'], function (createLoop) {

function input() {
if (mouseDown) {
velocity *= 1.0005;
direction = 1;
loop.setSlow(3);
} else {
velocity /= 1.0005;
direction = -1;
loop.setSlow(1);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/gameLoop.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
input();
while (lag >= slowStep) {
lag -= slowStep;
update(step);
update(step/slowStep);
}
frameTime += (delta - frameTime) / fpsFilterStrength;
render();
Expand Down

0 comments on commit a8e0611

Please sign in to comment.