Fixed test platform rotation. Added standing check area to the platform

This commit is contained in:
2026-06-20 14:43:34 +03:00
parent 24481b1f33
commit 6bfe08e76c
4 changed files with 16 additions and 8 deletions
+2 -5
View File
@@ -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]
+3 -2
View File
@@ -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)
+10
View File
@@ -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)
+1 -1
View File
@@ -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)