Skip to content

Commit

Permalink
fixed issue #5 (now player's speed doesn't depend on FPS)
Browse files Browse the repository at this point in the history
  • Loading branch information
D0NM committed Apr 16, 2014
1 parent 1cdc44d commit 0ce9b02
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/player.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";
waw.Player = waw.Unit.extend({
speed: 0.75,
speed: 4,
movement: {
left: false,
right: false,
Expand Down Expand Up @@ -189,10 +189,13 @@ waw.Player = waw.Unit.extend({
},
getNextPosition: function() {
var p = this.getPositionF(),
speed = this.speed,
x = p.x,
y = p.y;

var d = cc.Director.getInstance();
var fps = d.getAnimationInterval();
var speed = this.speed * fps * 10;

if ((this.movement.left || this.movement.right) &&
(this.movement.up || this.movement.down)) {
speed *= (2 / 3);
Expand Down

0 comments on commit 0ce9b02

Please sign in to comment.