SlimePlatformer/Characters/player.tscn
SnekInAScarf 815444f3af Slide over floor edges onto the wall below when pressing down
Two RayCast2D edge sensors point down into the floor edgeSensorRange to
each side of the slime. When one stops touching floor there's an edge in
range on that side, and pressing down slides to it, swings over the
corner and carries on down the wall so the slime ends flat against it.

- Down + a direction picks that side; down alone goes the way the slime
  is facing, or the other way if only that side has an edge in range.
- Down in the middle of a platform does nothing.
- edgeSensorRange is exported (default 24, tuned with a headless sweep).
- Wraps can now start with a straight move to the arc, and end with a
  move_and_slide so is_on_floor()/is_on_wall() aren't stale afterwards.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 13:02:05 -07:00

24 lines
905 B
Text
Executable file

[gd_scene format=3 uid="uid://uaxviwb40nn8"]
[ext_resource type="Script" uid="uid://drxbt88sjb1y4" path="res://Characters/player.gd" id="1_eovys"]
[ext_resource type="Texture2D" uid="uid://c3v26u2wh4it4" path="res://Assets/Player.png" id="2_eovys"]
[sub_resource type="CircleShape2D" id="CircleShape2D_eovys"]
[node name="Player" type="CharacterBody2D" unique_id=150873177]
script = ExtResource("1_eovys")
[node name="Sprite2D" type="Sprite2D" parent="." unique_id=1511454314]
texture = ExtResource("2_eovys")
offset = Vector2(0, -6)
[node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=1379572123]
shape = SubResource("CircleShape2D_eovys")
[node name="LeftEdgeSensor" type="RayCast2D" parent="."]
position = Vector2(-24, 0)
target_position = Vector2(0, 14)
[node name="RightEdgeSensor" type="RayCast2D" parent="."]
position = Vector2(24, 0)
target_position = Vector2(0, 14)