mirror of
https://github.com/wassname/GarageServer.IO.git
synced 2026-06-27 16:10:34 +08:00
Shared physics code - meant to show sharing, not best practices
This commit is contained in:
@@ -3,25 +3,7 @@ $(function () {
|
||||
logging: true,
|
||||
clientSidePrediction: true,
|
||||
interpolation: true,
|
||||
onUpdatePlayerPhysics: function (state, inputs) {
|
||||
var i = 0;
|
||||
if (!state.x && !state.y) {
|
||||
state.x = 0;
|
||||
state.y = 0;
|
||||
}
|
||||
for (i = 0; i < inputs.length; i ++) {
|
||||
if (inputs[i].input === 'left') {
|
||||
state.x -= 1;
|
||||
} else if (inputs[i].input === 'right') {
|
||||
state.x += 1;
|
||||
} else if (inputs[i].input === 'down') {
|
||||
state.y += 1;
|
||||
} else if (inputs[i].input === 'up') {
|
||||
state.y -= 1;
|
||||
}
|
||||
}
|
||||
return state;
|
||||
},
|
||||
onUpdatePlayerPhysics: OnProcessGamePhysics,
|
||||
onInterpolation: function (currentState, previousState, targetState, amount) {
|
||||
var interpolationState = {};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user