Add a behavior tree to the enemy

Add the Beehave addon.
Make the enemy do the same thing as before but with a behavior tree.
This commit is contained in:
Mathilde Grapin 2023-06-12 16:48:35 +02:00
parent 09f6925a00
commit 1aed988149
92 changed files with 4025 additions and 25 deletions

View file

@ -1,7 +1,8 @@
[gd_scene load_steps=6 format=3 uid="uid://bktg1ypaav3q3"]
[gd_scene load_steps=7 format=3 uid="uid://bktg1ypaav3q3"]
[ext_resource type="Texture2D" uid="uid://bbwsdd0jddmck" path="res://art/Pink_Monster_Walk_6.png" id="1_e5603"]
[ext_resource type="Script" path="res://scripts/enemy.gd" id="1_l5lyv"]
[ext_resource type="PackedScene" uid="uid://b51tdt5kunai" path="res://scenes/enemy_behavior_tree.tscn" id="3_jk76t"]
[sub_resource type="Animation" id="Animation_etqki"]
resource_name = "walk"
@ -45,3 +46,5 @@ libraries = {
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2(-0.5, -5)
shape = SubResource("RectangleShape2D_rlijp")
[node name="EnemyBehaviorTree" parent="." instance=ExtResource("3_jk76t")]

View file

@ -0,0 +1,22 @@
[gd_scene load_steps=6 format=3 uid="uid://b51tdt5kunai"]
[ext_resource type="Script" path="res://addons/beehave/nodes/beehave_tree.gd" id="1_b2pc4"]
[ext_resource type="Script" path="res://addons/beehave/nodes/composites/sequence.gd" id="2_80fm4"]
[ext_resource type="Script" path="res://scripts/is_idle_condition.gd" id="3_5jur1"]
[ext_resource type="Script" path="res://scripts/move_to_target_action.gd" id="4_1on4v"]
[ext_resource type="Script" path="res://scripts/get_random_top_cell.gd" id="4_ouqf7"]
[node name="EnemyBehaviorTree" type="Node"]
script = ExtResource("1_b2pc4")
[node name="ReturnBallSequence" type="Node" parent="."]
script = ExtResource("2_80fm4")
[node name="IsIdle" type="Node" parent="ReturnBallSequence"]
script = ExtResource("3_5jur1")
[node name="GetRandomTopCell" type="Node" parent="ReturnBallSequence"]
script = ExtResource("4_ouqf7")
[node name="MoveToTargetAction" type="Node" parent="ReturnBallSequence"]
script = ExtResource("4_1on4v")