Skip to content
This repository has been archived by the owner on Apr 15, 2022. It is now read-only.

Commit

Permalink
-Fixing Wind Up Racer to use Delta.
Browse files Browse the repository at this point in the history
  • Loading branch information
Todd Lewis committed Dec 18, 2015
1 parent 7162109 commit fc72a3b
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 18 deletions.
23 changes: 14 additions & 9 deletions lib/platypus.combined.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ this.platypus = this.platypus || {};
* @type String
* @static
**/
platypus.buildDate = /*=date*/"Tue, 15 Dec 2015 15:49:03 GMT"; // injected by build process
platypus.buildDate = /*=date*/"Fri, 18 Dec 2015 15:04:08 GMT"; // injected by build process

})();

Expand Down Expand Up @@ -14328,10 +14328,10 @@ Replicates logic for a wind-up toy: listens for a wind-up message over a series
"handle-logic": function (resp) {
if (this.racing) {
if (!this.blocked && this.right && this.state.right) {
this.owner.x += this.speed;
this.owner.x += this.speed * resp.delta;
this.owner.trigger('racing');
} else if (!this.blocked && this.left && this.state.left) {
this.owner.x -= this.speed;
this.owner.x -= this.speed * resp.delta;
this.owner.trigger('racing');
} else {
this.racing = false;
Expand Down Expand Up @@ -14506,7 +14506,8 @@ Replicates logic for a wind-up toy: listens for a wind-up message over a series
}

self.update = function (delta) {
var state = getInstantState();
var state = getInstantState(),
vState = getActiveVelocityState();

if (this.vector) {
if (this.accelerator) {
Expand All @@ -14515,9 +14516,13 @@ Replicates logic for a wind-up toy: listens for a wind-up message over a series
this.activeVelocity = this.active;
}
}

if (this.activeVelocity) {
if (this.ready && this.enact && state && getActiveVelocityState()) {
if (this.enact && !vState) { // Turn off ready if the state doesn't allow it.
this.ready = false;
}

if (this.ready && this.enact && state) {
this.ready = false; // to insure a single instance until things are reset
this.velocity.set(this.instant);
if (instantSuccess) {
Expand All @@ -14526,7 +14531,7 @@ Replicates logic for a wind-up toy: listens for a wind-up message over a series
} else if (!this.ready && !(this.enact && state)) {
this.ready = true;
this.decay();
} else if (getActiveVelocityState()) {
} else if (vState) {
return null;
}
return this.velocity;
Expand Down Expand Up @@ -14878,11 +14883,11 @@ Replicates logic for a wind-up toy: listens for a wind-up message over a series
* This event triggers an instant motion.
*
* @method 'instant-motion'
* @param control {Object|boolean} If `true`, this motion becomes active. If `false` or `{pressed: false}`, the motion becomes inactive.
* @param control {Object|boolean} If `true`, this motion becomes active. If `false` or `{triggered: false}`, the motion becomes inactive.
* @since 0.6.7
*/
"instant-motion": function (control) {
this.enact = (control && (control.pressed !== false));
this.enact = (control && (control.triggered !== false));
},

/**
Expand Down
Loading

0 comments on commit fc72a3b

Please sign in to comment.