The edge sensors now live under an EdgeSensors pivot that's rotated to point into whatever surface the slime is on. Pressing into the surface (down on floors, up on ceilings, towards the wall on walls) near an edge slides over it onto the side of the platform. The other axis picks the side; otherwise facing decides (last direction moved along a wall). - Ceiling edge -> wall above, wall top -> floor, wall bottom -> ceiling underneath, floor edge -> wall below, all through one code path. - Skip sensors that start inside something (inside corners). - _begin_wrap takes the normal of the surface to end up on and works out the sprite rotation from it; wraps can now end on a ceiling. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
26 lines
977 B
Text
Executable file
26 lines
977 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="EdgeSensors" type="Node2D" parent="."]
|
|
|
|
[node name="LeftEdgeSensor" type="RayCast2D" parent="EdgeSensors"]
|
|
position = Vector2(-24, 0)
|
|
target_position = Vector2(0, 14)
|
|
|
|
[node name="RightEdgeSensor" type="RayCast2D" parent="EdgeSensors"]
|
|
position = Vector2(24, 0)
|
|
target_position = Vector2(0, 14)
|