From cda69dcfd46d400cff1af7c427719dfd6367aaab Mon Sep 17 00:00:00 2001 From: Jeena Date: Tue, 18 Feb 2014 13:15:19 +0100 Subject: [PATCH 1/3] trying to smothen the differences between server and client --- app/Game/Client/GameController.js | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/app/Game/Client/GameController.js b/app/Game/Client/GameController.js index 6ca7a1c..2f08ab6 100755 --- a/app/Game/Client/GameController.js +++ b/app/Game/Client/GameController.js @@ -63,8 +63,8 @@ function (Parent, Box2D, PhysicsEngine, ViewManager, PlayerController, Notificat var gameObject = userData; if(updateData[gameObject.uid]) { var update = updateData[gameObject.uid]; - body.SetAwake(true); - body.SetPosition(update.p); + body.SetAwake(true); + body.SetPosition(this.centerBetween(update.p, body.GetPosition())); body.SetAngle(update.a); body.SetLinearVelocity(update.lv); body.SetAngularVelocity(update.av); @@ -80,6 +80,24 @@ function (Parent, Box2D, PhysicsEngine, ViewManager, PlayerController, Notificat } + GameController.prototype.centerBetween = function(n, o) { + var x, y; + + if(n.x > o.x) { + x = o.x + (n.x - o.x) / 2; + } else { + x = o.x - (o.x - n.x) / 2; + } + + if(n.y > o.y) { + y = o.y + (n.y - o.y) / 2; + } else { + y = o.y - (o.y - n.y) / 2; + } + + return {x:x, y:y}; + }; + GameController.prototype.onJoinMe = function (playerId) { this.me = this.players[playerId]; this.me.setPlayerController(new PlayerController(this.me)); From fa1a3f37579803c1b84642c05c1992210b88cd52 Mon Sep 17 00:00:00 2001 From: Jeena Date: Tue, 18 Feb 2014 13:51:03 +0100 Subject: [PATCH 2/3] fixed #52 --- app/Game/Config/Settings.js | 2 +- app/Game/Core/GameObjects/Item.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Game/Config/Settings.js b/app/Game/Config/Settings.js index ea054f9..9cf9fd3 100755 --- a/app/Game/Config/Settings.js +++ b/app/Game/Config/Settings.js @@ -33,7 +33,7 @@ define(function() { FLY_SPEED: 6.2, JUMP_SPEED: 20, JUMP_STOP_DAMPING_FACTOR: 0.5, - MAX_THROW_FORCE: 18, + MAX_THROW_FORCE: 18 * 3.5, MAX_THROW_ANGULAR_VELOCITY: 0, MAX_RUNNING_WEIGHT: 9, RESPAWN_TIME: 6, diff --git a/app/Game/Core/GameObjects/Item.js b/app/Game/Core/GameObjects/Item.js index d9b67ff..1e53f12 100644 --- a/app/Game/Core/GameObjects/Item.js +++ b/app/Game/Core/GameObjects/Item.js @@ -121,8 +121,8 @@ function (Parent, Box2D, Options, Settings) { body.SetAwake(true); var vector = new Box2D.Common.Math.b2Vec2( - x * Settings.MAX_THROW_FORCE, - -y * Settings.MAX_THROW_FORCE * 1.5 // 1.5 is to throw higher then far + x * Settings.MAX_THROW_FORCE / this.options.weight, + -y * Settings.MAX_THROW_FORCE * 1.5 / this.options.weight // 1.5 is to throw higher then far ); this.body.SetLinearVelocity(vector); From 6ba085e3c0bafc44072fe3df94ff98b6fa16c6e7 Mon Sep 17 00:00:00 2001 From: Jeena Date: Tue, 18 Feb 2014 14:08:48 +0100 Subject: [PATCH 3/3] fixed #54 it now gets read if it is under 30 --- app/Game/Client/View/Views/PixiView.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/Game/Client/View/Views/PixiView.js b/app/Game/Client/View/Views/PixiView.js index 79be315..087a03b 100755 --- a/app/Game/Client/View/Views/PixiView.js +++ b/app/Game/Client/View/Views/PixiView.js @@ -230,7 +230,9 @@ function (Parent, DomController, PIXI, Settings, NotificationCenter) { playerInfo.endFill(); if(options.healthFactor > 0) { - playerInfo.beginFill(0x00FF00); + var color = 0x00FF00; + if(options.healthFactor < 0.30) color = 0xFF0000; + playerInfo.beginFill(color); playerInfo.lineStyle(0, 0x000000); playerInfo.drawRect(borderWidth, borderWidth, width * options.healthFactor, height); playerInfo.endFill();