From 6bfe08e76cbd8c3fc1d5d4eef18889f16cf60b3b Mon Sep 17 00:00:00 2001 From: Ruslan Ignatov Date: Sat, 20 Jun 2026 14:43:34 +0300 Subject: [PATCH] Fixed test platform rotation. Added standing check area to the platform --- game/levels/test_level.tscn | 7 ++----- game/platform/abstract_platform.gd | 5 +++-- game/platform/abstract_platform.tscn | 10 ++++++++++ game/platform/moving_platform.gd | 2 +- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/game/levels/test_level.tscn b/game/levels/test_level.tscn index 7b249c2..74ddd49 100644 --- a/game/levels/test_level.tscn +++ b/game/levels/test_level.tscn @@ -61,8 +61,7 @@ position = Vector2(520, -35) points = PackedVector2Array(0, 0, 0, -76, -454, -76, -454, 3) [node name="SelfMovingPlatform" parent="Platforms" parent_id_path=PackedInt32Array(1140671629) index="0" unique_id=349378100 node_paths=PackedStringArray("path", "path_follow") instance=ExtResource("4_h1708")] -position = Vector2(201.03143, -75) -rotation = -3.1415925 +position = Vector2(229, -75) path = NodePath("../Path2D") path_follow = NodePath("../Path2D/PathFollow2D") platform_width = 104 @@ -71,9 +70,7 @@ platform_width = 104 curve = SubResource("Curve2D_h1708") [node name="PathFollow2D" type="PathFollow2D" parent="Platforms/Path2D" index="0" unique_id=1206016336] -position = Vector2(201.03143, -75) -rotation = 3.1415927 -progress = 27.97701 +position = Vector2(229, -75) rotates = false [node name="RemoteTransform2D" type="RemoteTransform2D" parent="Platforms/Path2D/PathFollow2D" index="0" unique_id=1642833722] diff --git a/game/platform/abstract_platform.gd b/game/platform/abstract_platform.gd index bce4514..f8e63a5 100644 --- a/game/platform/abstract_platform.gd +++ b/game/platform/abstract_platform.gd @@ -36,6 +36,7 @@ const MAX_WIDTH = TILE_SIZE * 32 @onready var collision: CollisionShape2D = $CollisionShape2D +@onready var standing_check_collision: CollisionShape2D = $Area2D/CollisionShape2D @onready var sub_viewport: SubViewport = $SubViewport @onready var platform_sprite: Sprite2D = $Sprite2D @onready var platform_rect: ColorRect = $SubViewport/PlatformRect @@ -50,8 +51,8 @@ func _ready() -> void: func rebuild_platform() -> void: - var shape := collision.shape as RectangleShape2D - shape.size.x = platform_width + collision.shape.size.x = platform_width + standing_check_collision.shape.size.x = platform_width - 4 var platfor_size := Vector2(platform_width, TILE_SIZE) diff --git a/game/platform/abstract_platform.tscn b/game/platform/abstract_platform.tscn index 9c64b8a..12cd9c5 100644 --- a/game/platform/abstract_platform.tscn +++ b/game/platform/abstract_platform.tscn @@ -493,6 +493,9 @@ animations = [{ resource_local_to_scene = true size = Vector2(16, 7) +[sub_resource type="RectangleShape2D" id="RectangleShape2D_bhunq"] +size = Vector2(12, 1) + [node name="AbstractPlatform" type="AnimatableBody2D" unique_id=137546339] collision_mask = 0 script = ExtResource("1_426vp") @@ -532,3 +535,10 @@ sprite_frames = SubResource("SpriteFrames_j4n83") [node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=175449124] position = Vector2(0, -0.5) shape = SubResource("RectangleShape2D_jsq8n") + +[node name="Area2D" type="Area2D" parent="." unique_id=1655744842] + +[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D" unique_id=1261028767] +position = Vector2(0, -4.5) +shape = SubResource("RectangleShape2D_bhunq") +debug_color = Color(0.9020316, 0.24375501, 0.4918024, 0.41960785) diff --git a/game/platform/moving_platform.gd b/game/platform/moving_platform.gd index 77b0221..cbc248f 100644 --- a/game/platform/moving_platform.gd +++ b/game/platform/moving_platform.gd @@ -66,7 +66,7 @@ func _select_animation() -> void: icon_sprite.play(ANIMATION_SELF_MOVING) return - var direction : String = ANIMATION_MAP[type][not is_reverse] + var direction : String = ANIMATION_MAP[type][is_reverse] var suffix := ANIMATION_ACTIVE_SUFFIX if is_moving else ANIMATION_STATIC_SUFFIX icon_sprite.play(ANIMATION_MOVING_PREFIX + direction + suffix)