mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-14 11:03:46 +00:00
Enemy Navigation Movement
This commit is contained in:
parent
388747ccb3
commit
9d302e48e6
5 changed files with 247 additions and 15 deletions
|
|
@ -1,10 +1,13 @@
|
|||
[gd_scene load_steps=32 format=3 uid="uid://bqjcwxene73l2"]
|
||||
[gd_scene load_steps=36 format=3 uid="uid://bqjcwxene73l2"]
|
||||
|
||||
[ext_resource type="Script" path="res://Scripts/Components/Actors/Actor.cs" id="1_k5cyk"]
|
||||
[ext_resource type="Texture2D" uid="uid://hukxr2e63gky" path="res://Sprites/Actors/Robot3.png" id="2_wt8wl"]
|
||||
[ext_resource type="Script" path="res://Scripts/Components/Actors/ActorFreeMovement.cs" id="3_4dv5b"]
|
||||
[ext_resource type="Script" path="res://Scripts/Components/Actors/EnemyPossessionMovement.cs" id="3_a5upk"]
|
||||
[ext_resource type="Script" path="res://Scripts/Components/Actors/KeyboardInputProvider.cs" id="4_8bcq6"]
|
||||
[ext_resource type="Script" path="res://Scripts/Components/Actors/AnimationHandler.cs" id="5_c7ovk"]
|
||||
[ext_resource type="Script" path="res://Scripts/Components/Actors/ActorAi.cs" id="6_jlcsg"]
|
||||
[ext_resource type="Script" path="res://Scripts/Components/Actors/EnemyNavigationMovement.cs" id="7_fvl12"]
|
||||
[ext_resource type="Script" path="res://Scripts/Components/ProximityPlayerDetection.cs" id="8_62r5q"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_spe0p"]
|
||||
atlas = ExtResource("2_wt8wl")
|
||||
|
|
@ -220,6 +223,9 @@ animations = [{
|
|||
[sub_resource type="CircleShape2D" id="CircleShape2D_2b36v"]
|
||||
radius = 5.0
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_sthwe"]
|
||||
radius = 85.0529
|
||||
|
||||
[node name="ActorEnemyTest" type="CharacterBody2D"]
|
||||
collision_layer = 16
|
||||
collision_mask = 115
|
||||
|
|
@ -232,7 +238,7 @@ sprite_frames = SubResource("SpriteFrames_ix17a")
|
|||
animation = &"walk_down"
|
||||
|
||||
[node name="MovementProvider" type="Node2D" parent="."]
|
||||
script = ExtResource("3_4dv5b")
|
||||
script = ExtResource("3_a5upk")
|
||||
|
||||
[node name="InputProvider" type="Node2D" parent="MovementProvider"]
|
||||
script = ExtResource("4_8bcq6")
|
||||
|
|
@ -243,3 +249,33 @@ shape = SubResource("CircleShape2D_2b36v")
|
|||
[node name="AnimationHandler" type="Node2D" parent="." node_paths=PackedStringArray("_animatedSprite")]
|
||||
script = ExtResource("5_c7ovk")
|
||||
_animatedSprite = NodePath("../AnimatedSprite2D")
|
||||
|
||||
[node name="ActorAi" type="Node2D" parent="."]
|
||||
script = ExtResource("6_jlcsg")
|
||||
Ai = 0
|
||||
|
||||
[node name="NavigationMovementProvider" type="Node2D" parent="." node_paths=PackedStringArray("_playerDetection")]
|
||||
script = ExtResource("7_fvl12")
|
||||
_navigationEnabled = true
|
||||
_playerDetection = NodePath("../PlayerDetection")
|
||||
|
||||
[node name="PlayerDetection" type="Area2D" parent="."]
|
||||
visible = false
|
||||
collision_layer = 16
|
||||
collision_mask = 2
|
||||
script = ExtResource("8_62r5q")
|
||||
|
||||
[node name="PlayerDetectionArea" type="CollisionShape2D" parent="PlayerDetection"]
|
||||
shape = SubResource("CircleShape2D_sthwe")
|
||||
|
||||
[node name="NavigationAgent2D" type="NavigationAgent2D" parent="."]
|
||||
target_desired_distance = 64.0
|
||||
path_max_distance = 800.0
|
||||
path_postprocessing = 1
|
||||
avoidance_enabled = true
|
||||
debug_enabled = true
|
||||
debug_path_custom_color = Color(1, 0, 0, 1)
|
||||
|
||||
[connection signal="area_entered" from="PlayerDetection" to="PlayerDetection" method="_on_area_entered"]
|
||||
[connection signal="area_exited" from="PlayerDetection" to="PlayerDetection" method="_on_area_exited"]
|
||||
[connection signal="velocity_computed" from="NavigationAgent2D" to="NavigationMovementProvider" method="_on_navigation_agent_2d_velocity_computed"]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue