mirror of
https://github.com/wassname/GarageServer.IO.git
synced 2026-06-27 16:10:34 +08:00
Updated GarageServer.IO API calls to support client side prediction for entities - #20
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
(function(exports){
|
||||
|
||||
exports.getNewPlayerState = function (state, inputs, deltaTime, garageServer) {
|
||||
exports.getNewPlayerState = function (id, state, inputs, deltaTime, garageServer) {
|
||||
var i = 0, distance = 0, newState = {};
|
||||
|
||||
if (!state.ang && state.ang !== 0) {
|
||||
@@ -28,7 +28,7 @@
|
||||
} else if (inputs[i].input === 'space') {
|
||||
if (garageServer && (new Date().getTime() - newState.lastFire) > 1000) {
|
||||
var newId = guid();
|
||||
garageServer.addEntity(newId);
|
||||
garageServer.addEntity(newId, id);
|
||||
garageServer.updateEntityState(newId, { x: newState.x, y: newState.y, ang: newState.ang } );
|
||||
newState.lastFire = new Date().getTime();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user