Code cleanup

This commit is contained in:
Jeremiah Billmann
2013-07-09 21:40:51 -04:00
parent faf5434d23
commit 39751c8044
6 changed files with 20 additions and 26 deletions
+7 -8
View File
@@ -1,6 +1,6 @@
(function(exports){
exports.getNewPlayerState = function (state, inputs, deltaTime) {
exports.getNewState = function (state, inputs, deltaTime) {
var i = 0;
if (!state.x && !state.y) {
@@ -21,12 +21,11 @@
return state;
};
exports.onUpdateEntityPhysics = function (id, state, deltaTime) {
if (!state.x && !state.y) {
state.x = 0;
state.y = 0;
}
state.x += (10 * deltaTime);
exports.getInterpolatedState = function (previousState, targetState, amount) {
var interpolationState = {};
interpolationState.x = (previousState.x + amount * (targetState.x - previousState.x));
interpolationState.y = (previousState.y + amount * (targetState.y - previousState.y));
return interpolationState;
};
})(typeof exports === 'undefined' ? window : exports);
})(typeof exports === 'undefined' ? window.GamePhysics = {} : exports);