working force push with raycast

This commit is contained in:
WillowBarkerJones committed 2025-01-13 19:30:02 -05:00
1 parent 25288b722b
commit 08a1145c50
5 files changed
+106 -18

No files matched your search

+20 -12
View File
@@ -1,8 +1,8 @@
[gd_scene load_steps=9 format=3 uid="uid://csqvvi0t51tkk"]
[gd_scene load_steps=8 format=3 uid="uid://csqvvi0t51tkk"]
[ext_resource type="PackedScene" uid="uid://dqsi0p3t8k43x" path="res://Scenes/crate.tscn" id="1_34u55"]
[ext_resource type="Script" path="res://Scripts/gamecontroller.gd" id="1_pru2w"]
[ext_resource type="Script" path="res://Scripts/charactercontroller.gd" id="2_543ck"]
[ext_resource type="PackedScene" uid="uid://5p0tso7jy35l" path="res://Scenes/player.tscn" id="3_d2fxm"]
[ext_resource type="Script" path="res://Scripts/Trigger.gd" id="3_wy0yn"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_nbgu3"]
@@ -10,8 +10,6 @@ size = Vector2(34, 14)
[sub_resource type="WorldBoundaryShape2D" id="WorldBoundaryShape2D_rywi2"]
[sub_resource type="CircleShape2D" id="CircleShape2D_n1jqc"]
[sub_resource type="CircleShape2D" id="CircleShape2D_5gjsm"]
radius = 60.0167
@@ -30,7 +28,7 @@ position = Vector2(515, 226)
rotation = -0.722934
[node name="RigidBody2D2" parent="." instance=ExtResource("1_34u55")]
position = Vector2(508, 126)
position = Vector2(286, 285)
rotation = 0.295972
[node name="RigidBody2D3" parent="." instance=ExtResource("1_34u55")]
@@ -38,14 +36,14 @@ position = Vector2(427, 201)
rotation = -2.25067
[node name="RigidBody2D4" parent="." instance=ExtResource("1_34u55")]
position = Vector2(436, 259)
position = Vector2(224, 127)
[node name="RigidBody2D5" parent="." instance=ExtResource("1_34u55")]
position = Vector2(365, 241)
rotation = -0.505816
[node name="RigidBody2D6" parent="." instance=ExtResource("1_34u55")]
position = Vector2(378, 136)
position = Vector2(104, 103)
rotation = 0.727138
[node name="Floor" type="StaticBody2D" parent="."]
@@ -55,13 +53,23 @@ metadata/_edit_group_ = true
[node name="CollisionShape2D" type="CollisionShape2D" parent="Floor"]
shape = SubResource("WorldBoundaryShape2D_rywi2")
[node name="CharacterBody2D" type="CharacterBody2D" parent="."]
position = Vector2(571, 162)
script = ExtResource("2_543ck")
[node name="Left Wall" type="StaticBody2D" parent="."]
position = Vector2(0, 245)
rotation = 1.5708
metadata/_edit_group_ = true
[node name="CollisionShape2D" type="CollisionShape2D" parent="CharacterBody2D"]
shape = SubResource("CircleShape2D_n1jqc")
[node name="CollisionShape2D" type="CollisionShape2D" parent="Left Wall"]
shape = SubResource("WorldBoundaryShape2D_rywi2")
[node name="Right Wall" type="StaticBody2D" parent="."]
position = Vector2(841, 225)
rotation = 4.70835
metadata/_edit_group_ = true
[node name="CollisionShape2D" type="CollisionShape2D" parent="Right Wall"]
shape = SubResource("WorldBoundaryShape2D_rywi2")
[node name="CharacterBody2D" parent="." instance=ExtResource("3_d2fxm")]
[node name="Area2D" type="Area2D" parent="."]
position = Vector2(663, 356)
+19
View File
@@ -0,0 +1,19 @@
[gd_scene load_steps=3 format=3 uid="uid://5p0tso7jy35l"]
[ext_resource type="Script" path="res://Scripts/charactercontroller.gd" id="1_tlb8a"]
[sub_resource type="CircleShape2D" id="CircleShape2D_n1jqc"]
[node name="CharacterBody2D" type="CharacterBody2D"]
script = ExtResource("1_tlb8a")
metadata/_edit_group_ = true
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource("CircleShape2D_n1jqc")
[node name="RightRay" type="RayCast2D" parent="."]
target_position = Vector2(33, 0)
collide_with_areas = true
[node name="LeftRay" type="RayCast2D" parent="."]
target_position = Vector2(-33, 0)