diff --git a/src/client/haxe/ru/m/tankz/render/Render.hx b/src/client/haxe/ru/m/tankz/render/Render.hx index 2cd3f84..858a7f7 100755 --- a/src/client/haxe/ru/m/tankz/render/Render.hx +++ b/src/client/haxe/ru/m/tankz/render/Render.hx @@ -35,14 +35,16 @@ class BrickState implements IState { class EntityState implements IState { private var x:Float; private var y:Float; + private var d:Direction; private var type:Int; public function new() {} public function update(object:Entity):Bool { - if (x != object.rect.x || y != object.rect.y) { + if (x != object.rect.x || y != object.rect.y || !d.equals(object.rect.direction)) { x = object.rect.x; y = object.rect.y; + d = object.rect.direction; return true; } if (Std.is(object, Tank)) { diff --git a/src/common/haxe/ru/m/geom/Direction.hx b/src/common/haxe/ru/m/geom/Direction.hx index 21d2248..4541324 100644 --- a/src/common/haxe/ru/m/geom/Direction.hx +++ b/src/common/haxe/ru/m/geom/Direction.hx @@ -23,6 +23,10 @@ class Direction { return from(-x, -y); } + public function equals(other:Direction):Bool { + return other.x == x && other.y == y; + } + public static function from(x:Int, y:Int):Direction { return directions.get(x + y * 10); } @@ -36,4 +40,8 @@ class Direction { case _: null; } } + + public function toString():String { + return 'Direction{x=$x,y=$y}'; + } } diff --git a/src/common/haxe/ru/m/tankz/core/Tank.hx b/src/common/haxe/ru/m/tankz/core/Tank.hx index 0927b4b..ebefd36 100755 --- a/src/common/haxe/ru/m/tankz/core/Tank.hx +++ b/src/common/haxe/ru/m/tankz/core/Tank.hx @@ -46,10 +46,10 @@ class Tank extends MobileEntity { override public function move(direction:Direction):Void { // ToDo: spike - if (direction != this.direction) { + /*if (direction != this.direction) { rect.x -= this.direction.x * 4; rect.y -= this.direction.y * 4; - } + }*/ super.move(direction); }