diff --git a/DungeonShooting_Godot/src/framework/ActivityObject.cs b/DungeonShooting_Godot/src/framework/ActivityObject.cs index bec83d7..0bce3e1 100644 --- a/DungeonShooting_Godot/src/framework/ActivityObject.cs +++ b/DungeonShooting_Godot/src/framework/ActivityObject.cs @@ -455,19 +455,20 @@ if (_throwData != null && !_throwData.IsOver) { _throwData.LinearVelocity = MoveAndSlide(_throwData.LinearVelocity); - Position = new Vector2(Position.x, Position.y - _throwData.YSpeed * delta); - var rotate = GlobalRotationDegrees + _throwData.RotateSpeed * delta; - GlobalRotationDegrees = rotate; - - var pos = AnimatedSprite.GlobalPosition; - ShadowSprite.GlobalRotationDegrees = rotate; + GlobalRotationDegrees = GlobalRotationDegrees + _throwData.RotateSpeed * delta; + if (Scale.y < 0) + { + AnimatedSprite.GlobalPosition = GlobalPosition + new Vector2(0, -_throwData.Y) - _throwData.OriginSpritePosition.Rotated(Rotation) * Scale.Abs(); + } + else + { + AnimatedSprite.GlobalPosition = GlobalPosition + new Vector2(0, -_throwData.Y) + _throwData.OriginSpritePosition.Rotated(Rotation); + } var ysp = _throwData.YSpeed; _throwData.Y += _throwData.YSpeed * delta; _throwData.YSpeed -= GameConfig.G * delta; - - AnimatedSprite.ZIndex = Mathf.Max(0, (int)_throwData.Y); //达到最高点 if (ysp * _throwData.YSpeed < 0) @@ -479,7 +480,6 @@ //落地判断 if (_throwData.Y <= 0) { - Collision.GlobalPosition = pos; _throwData.IsOver = true; @@ -510,11 +510,6 @@ ThrowOver(); } } - else - { - //碰撞器位置 - Collision.GlobalPosition = pos + new Vector2(0, _throwData.Y); - } } //阴影 @@ -616,7 +611,7 @@ //缩放 ShadowSprite.Scale = AnimatedSprite.Scale; //阴影角度 - ShadowSprite.GlobalRotationDegrees = GlobalRotationDegrees; + ShadowSprite.Rotation = 0; //阴影位置计算 var pos = AnimatedSprite.GlobalPosition; if (_throwData != null && !_throwData.IsOver) @@ -710,7 +705,7 @@ _throwData.OriginRotation = Collision.Rotation; _throwData.OriginScale = Collision.Scale; _throwData.OriginZIndex = ZIndex; - _throwData.OriginSpriteZIndex = AnimatedSprite.ZIndex; + _throwData.OriginSpritePosition = AnimatedSprite.Position; _throwData.OriginCollisionEnable = Collision.Disabled; _throwData.OriginCollisionPosition = Collision.Position; _throwData.OriginCollisionRotation = Collision.Rotation; @@ -724,12 +719,10 @@ } Collision.Shape = _throwData.RectangleShape; - //Collision.Position = Vector2.Zero; + Collision.Position = Vector2.Zero; Collision.Rotation = 0; Collision.Scale = Vector2.One; ZIndex = 0; - AnimatedSprite.ZIndex = 0; - //ZIndex = 2; Collision.Disabled = false; Collision.Position = Vector2.Zero; Collision.Rotation = 0; @@ -752,7 +745,7 @@ Collision.Rotation = _throwData.OriginRotation; Collision.Scale = _throwData.OriginScale; ZIndex = _throwData.OriginZIndex; - AnimatedSprite.ZIndex = _throwData.OriginSpriteZIndex; + AnimatedSprite.Position = _throwData.OriginSpritePosition; Collision.Disabled = _throwData.OriginCollisionEnable; Collision.Position = _throwData.OriginCollisionPosition; Collision.Rotation = _throwData.OriginCollisionRotation; diff --git a/DungeonShooting_Godot/src/framework/ObjectThrowData.cs b/DungeonShooting_Godot/src/framework/ObjectThrowData.cs index 11e7f94..ec4ffd3 100644 --- a/DungeonShooting_Godot/src/framework/ObjectThrowData.cs +++ b/DungeonShooting_Godot/src/framework/ObjectThrowData.cs @@ -83,7 +83,7 @@ public float OriginRotation; public Vector2 OriginScale; public int OriginZIndex; - public int OriginSpriteZIndex; + public Vector2 OriginSpritePosition; public bool OriginCollisionEnable; public Vector2 OriginCollisionPosition; public float OriginCollisionRotation; diff --git a/DungeonShooting_Godot/src/game/room/RoomManager.cs b/DungeonShooting_Godot/src/game/room/RoomManager.cs index 09b8975..c0abced 100644 --- a/DungeonShooting_Godot/src/game/room/RoomManager.cs +++ b/DungeonShooting_Godot/src/game/room/RoomManager.cs @@ -39,6 +39,7 @@ public override void _EnterTree() { + //Engine.TimeScale = 0.2f; Input.MouseMode = Input.MouseModeEnum.Hidden; _sortRoot = GetNode("SortRoot");