diff --git a/app/Game/Client/GameController.js b/app/Game/Client/GameController.js index bb442d2..812ce21 100755 --- a/app/Game/Client/GameController.js +++ b/app/Game/Client/GameController.js @@ -65,8 +65,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); @@ -82,6 +82,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)); 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(); 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);