working force push with raycast

This commit is contained in:
GabriellePipo committed 2025-01-13 19:30:20 -05:00
1 parent 14f739c428
commit 6f55d9442c
5 files changed
+93 -27

No files matched your search

+5 -14
View File
@@ -1,15 +1,13 @@
[gd_scene load_steps=9 format=3 uid="uid://cxnmaxykhbgaq"]
[gd_scene load_steps=8 format=3 uid="uid://cxnmaxykhbgaq"]
[ext_resource type="PackedScene" uid="uid://63qb2drh1l33" path="res://scenes/crate.tscn" id="1_0wmww"]
[ext_resource type="Script" path="res://scripts/gamecontroller.gd" id="1_5dy8j"]
[ext_resource type="Script" path="res://scripts/player.gd" id="2_aq17o"]
[ext_resource type="Script" path="res://scripts/Trigger.gd" id="3_4laji"]
[ext_resource type="PackedScene" uid="uid://c1cuiluq1fcpk" path="res://scenes/player.tscn" id="3_w28al"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_f1luk"]
size = Vector2(172, 20)
[sub_resource type="CircleShape2D" id="CircleShape2D_y4y41"]
[sub_resource type="WorldBoundaryShape2D" id="WorldBoundaryShape2D_k1pyx"]
[sub_resource type="CircleShape2D" id="CircleShape2D_wdyhk"]
@@ -19,7 +17,7 @@ radius = 34.1321
script = ExtResource("1_5dy8j")
[node name="StaticBody2D" type="StaticBody2D" parent="."]
position = Vector2(302, 266)
position = Vector2(302, 430)
metadata/_edit_group_ = true
[node name="CollisionShape2D" type="CollisionShape2D" parent="StaticBody2D"]
@@ -33,14 +31,7 @@ rotation = 0.688747
position = Vector2(391, 64)
rotation = 0.358379
[node name="CharacterBody2D" type="CharacterBody2D" parent="."]
position = Vector2(286, 181)
script = ExtResource("2_aq17o")
metadata/_edit_group_ = true
[node name="CollisionShape2D" type="CollisionShape2D" parent="CharacterBody2D"]
shape = SubResource("CircleShape2D_y4y41")
debug_color = Color(0.752941, 0.211765, 0.984314, 0.419608)
[node name="CharacterBody2D" parent="." instance=ExtResource("3_w28al")]
[node name="StaticBody2D2" type="StaticBody2D" parent="."]
position = Vector2(299, 490)
@@ -50,7 +41,7 @@ metadata/_edit_group_ = true
shape = SubResource("WorldBoundaryShape2D_k1pyx")
[node name="Trigger" type="Area2D" parent="."]
position = Vector2(439, 460)
position = Vector2(736, 460)
script = ExtResource("3_4laji")
metadata/_edit_group_ = true
+20
View File
@@ -0,0 +1,20 @@
[gd_scene load_steps=3 format=3 uid="uid://c1cuiluq1fcpk"]
[ext_resource type="Script" path="res://scripts/player.gd" id="1_s1kdl"]
[sub_resource type="CircleShape2D" id="CircleShape2D_y4y41"]
[node name="CharacterBody2D" type="CharacterBody2D"]
script = ExtResource("1_s1kdl")
metadata/_edit_group_ = true
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource("CircleShape2D_y4y41")
debug_color = Color(0.752941, 0.211765, 0.984314, 0.419608)
[node name="RightRay" type="RayCast2D" parent="."]
target_position = Vector2(15, 0)
collide_with_areas = true
[node name="LeftRay" type="RayCast2D" parent="."]
target_position = Vector2(-15, 0)