working force push with raycast

This commit is contained in:
Darius committed 2025-01-13 19:30:08 -05:00
1 parent 36595fc9a6
commit 80a771f3a9
5 files changed
+91 -18

No files matched your search

+3 -12
View File
@@ -1,9 +1,9 @@
[gd_scene load_steps=9 format=3 uid="uid://dcmyx5g6dksl8"]
[gd_scene load_steps=8 format=3 uid="uid://dcmyx5g6dksl8"]
[ext_resource type="PackedScene" uid="uid://d1ej2kiy7jcpv" path="res://scenes/crate.tscn" id="1_uivx3"]
[ext_resource type="Script" path="res://scripts/gamecontroller.gd" id="1_vhl00"]
[ext_resource type="Script" path="res://scripts/charactercontroller.gd" id="2_6rbcc"]
[ext_resource type="Script" path="res://scripts/trigger.gd" id="3_2qbah"]
[ext_resource type="PackedScene" uid="uid://b75mow511wmmb" path="res://scenes/player.tscn" id="3_8h5jv"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_1cyeq"]
size = Vector2(101, 20)
@@ -11,8 +11,6 @@ size = Vector2(101, 20)
[sub_resource type="WorldBoundaryShape2D" id="WorldBoundaryShape2D_bqh70"]
distance = -395.0
[sub_resource type="CircleShape2D" id="CircleShape2D_i8a0m"]
[sub_resource type="CircleShape2D" id="CircleShape2D_mfh1j"]
[node name="Game" type="Node2D"]
@@ -47,14 +45,7 @@ rotation = 0.806532
[node name="CollisionShape2D" type="CollisionShape2D" parent="floor"]
shape = SubResource("WorldBoundaryShape2D_bqh70")
[node name="CharacterBody2D" type="CharacterBody2D" parent="."]
position = Vector2(443, 322)
script = ExtResource("2_6rbcc")
metadata/_edit_group_ = true
[node name="CollisionShape2D" type="CollisionShape2D" parent="CharacterBody2D"]
shape = SubResource("CircleShape2D_i8a0m")
debug_color = Color(1, 0, 0, 0.419608)
[node name="CharacterBody2D" parent="." instance=ExtResource("3_8h5jv")]
[node name="Area2D" type="Area2D" parent="."]
position = Vector2(513, 319)
+19
View File
@@ -0,0 +1,19 @@
[gd_scene load_steps=3 format=3 uid="uid://b75mow511wmmb"]
[ext_resource type="Script" path="res://scripts/charactercontroller.gd" id="1_racyk"]
[sub_resource type="CircleShape2D" id="CircleShape2D_i8a0m"]
[node name="CharacterBody2D" type="CharacterBody2D"]
script = ExtResource("1_racyk")
metadata/_edit_group_ = true
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource("CircleShape2D_i8a0m")
debug_color = Color(1, 0, 0, 0.419608)
[node name="RightRay" type="RayCast2D" parent="."]
target_position = Vector2(25, 0)
[node name="LeftRay" type="RayCast2D" parent="."]
target_position = Vector2(-25, 0)