Update demo project

This commit is contained in:
Serhii Snitsaruk 2023-07-23 18:16:52 +02:00
parent 243da98b00
commit c095ee9c5d
9 changed files with 53 additions and 49 deletions

View File

@ -1,4 +1,4 @@
[gd_resource type="BehaviorTree" load_steps=9 format=3 uid="uid://cjkqi41oagagd"]
[gd_resource type="BehaviorTree" load_steps=10 format=3 uid="uid://cjkqi41oagagd"]
[ext_resource type="Script" path="res://ai/tasks/arrive_pos.gd" id="1_rhs33"]
[ext_resource type="Script" path="res://ai/tasks/play_animation.gd" id="2_dg0ss"]
@ -14,8 +14,11 @@ script = ExtResource("2_dg0ss")
animation_name = "bounce"
animation_player = NodePath("AnimationPlayer")
[sub_resource type="BTWait" id="BTWait_qs55a"]
duration = 0.1
[sub_resource type="BTSequence" id="BTSequence_a2ng0"]
children = [SubResource("BTAction_3xal7"), SubResource("BTAction_yq1vl")]
children = [SubResource("BTAction_3xal7"), SubResource("BTAction_yq1vl"), SubResource("BTWait_qs55a")]
[sub_resource type="BTForEach" id="BTForEach_0cp04"]
children = [SubResource("BTSequence_a2ng0")]

View File

@ -1,5 +1,5 @@
#*
#* test_waypoints.gd
#* example_waypoints.gd
#* =============================================================================
#* Copyright 2021-2023 Serhii Snitsaruk
#*
@ -11,18 +11,18 @@
extends Node2D
@onready var agent: CharacterBody2D = $Agent
@onready var agent_2: CharacterBody2D = $Agent2
@onready var agent1: CharacterBody2D = $Agent
@onready var agent2: CharacterBody2D = $Agent2
func _ready() -> void:
var waypoints: Array[Node] = $Waypoints.get_children()
for wp in waypoints:
agent.add_waypoint(wp.global_position)
agent1.add_waypoint(wp.global_position)
waypoints.reverse()
for wp in waypoints:
agent_2.add_waypoint(wp.global_position)
agent2.add_waypoint(wp.global_position)

View File

@ -0,0 +1,30 @@
[gd_scene load_steps=4 format=3 uid="uid://p5i7fdku3hqs"]
[ext_resource type="Script" path="res://examples/waypoints/example_waypoints.gd" id="1_d4sso"]
[ext_resource type="Script" path="res://examples/waypoints/waypoint_marker.gd" id="2_l26sl"]
[ext_resource type="PackedScene" uid="uid://c26b8c8dndtop" path="res://examples/waypoints/patrolling_agent.tscn" id="3_t4qgi"]
[node name="ExampleWaypoints" type="Node2D"]
script = ExtResource("1_d4sso")
[node name="Waypoints" type="Node2D" parent="."]
[node name="WP1" type="Marker2D" parent="Waypoints"]
position = Vector2(258, 126)
script = ExtResource("2_l26sl")
[node name="WP2" type="Marker2D" parent="Waypoints"]
position = Vector2(830, 131)
script = ExtResource("2_l26sl")
[node name="WP3" type="Marker2D" parent="Waypoints"]
position = Vector2(534, 492)
script = ExtResource("2_l26sl")
[node name="Agent" parent="." instance=ExtResource("3_t4qgi")]
y_sort_enabled = true
position = Vector2(57, 59)
[node name="Agent2" parent="." instance=ExtResource("3_t4qgi")]
y_sort_enabled = true
position = Vector2(316, 590)

View File

@ -1,5 +1,5 @@
#*
#* Agent.gd
#* patrolling_agent.gd
#* =============================================================================
#* Copyright 2021-2023 Serhii Snitsaruk
#*

View File

@ -1,8 +1,8 @@
[gd_scene load_steps=7 format=3 uid="uid://c26b8c8dndtop"]
[ext_resource type="Script" path="res://tests/waypoints/Agent.gd" id="1_1l3ql"]
[ext_resource type="BehaviorTree" uid="uid://cjkqi41oagagd" path="res://ai/trees/waypoints.tres" id="2_ijwrx"]
[ext_resource type="Texture2D" uid="uid://d0mht3ntak7e5" path="res://icon.png" id="2_xqtrc"]
[ext_resource type="Script" path="res://examples/waypoints/patrolling_agent.gd" id="1_5wwhb"]
[ext_resource type="BehaviorTree" uid="uid://cjkqi41oagagd" path="res://ai/trees/waypoints.tres" id="2_66y4v"]
[ext_resource type="Texture2D" uid="uid://d0mht3ntak7e5" path="res://icon.png" id="3_j5bxx"]
[sub_resource type="Animation" id="Animation_5id00"]
length = 0.001
@ -21,6 +21,7 @@ tracks/0/keys = {
[sub_resource type="Animation" id="Animation_4w16c"]
resource_name = "bounce"
length = 0.6
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
@ -28,8 +29,8 @@ tracks/0/path = NodePath("Sprite2D:scale")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.5, 1),
"transitions": PackedFloat32Array(1, 1, 1),
"times": PackedFloat32Array(0, 0.3, 0.6),
"transitions": PackedFloat32Array(0.5, 2, 1),
"update": 0,
"values": [Vector2(1, 1), Vector2(2, 2), Vector2(1, 1)]
}
@ -40,17 +41,17 @@ _data = {
"bounce": SubResource("Animation_4w16c")
}
[node name="Agent" type="CharacterBody2D"]
script = ExtResource("1_1l3ql")
[node name="PatrollingAgent" type="CharacterBody2D"]
script = ExtResource("1_5wwhb")
[node name="BTPlayer" type="BTPlayer" parent="."]
behavior_tree = ExtResource("2_ijwrx")
behavior_tree = ExtResource("2_66y4v")
_blackboard_data = {
"speed": 200.0
}
[node name="Sprite2D" type="Sprite2D" parent="."]
texture = ExtResource("2_xqtrc")
texture = ExtResource("3_j5bxx")
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
libraries = {

View File

@ -16,9 +16,9 @@ dest_files=["res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.cte
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/bptc_ldr=0
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false

View File

@ -11,7 +11,7 @@ config_version=5
[application]
config/name="LimboAI Test"
run/main_scene="res://tests/waypoints/test_waypoints.tscn"
run/main_scene="res://examples/waypoints/example_waypoints.tscn"
config/features=PackedStringArray("4.1")
config/icon="res://icon.png"

View File

@ -1,30 +0,0 @@
[gd_scene load_steps=4 format=3 uid="uid://p5i7fdku3hqs"]
[ext_resource type="PackedScene" uid="uid://c26b8c8dndtop" path="res://tests/waypoints/Agent.tscn" id="1_esee5"]
[ext_resource type="Script" path="res://tests/waypoints/test_waypoints.gd" id="1_kmjjq"]
[ext_resource type="Script" path="res://tests/waypoints/waypoint_marker.gd" id="3_1aub7"]
[node name="test_waypoints" type="Node2D"]
script = ExtResource("1_kmjjq")
[node name="Waypoints" type="Node2D" parent="."]
[node name="WP1" type="Marker2D" parent="Waypoints"]
position = Vector2(258, 126)
script = ExtResource("3_1aub7")
[node name="WP2" type="Marker2D" parent="Waypoints"]
position = Vector2(830, 131)
script = ExtResource("3_1aub7")
[node name="WP3" type="Marker2D" parent="Waypoints"]
position = Vector2(534, 492)
script = ExtResource("3_1aub7")
[node name="Agent" parent="." instance=ExtResource("1_esee5")]
y_sort_enabled = true
position = Vector2(57, 59)
[node name="Agent2" parent="." instance=ExtResource("1_esee5")]
y_sort_enabled = true
position = Vector2(316, 590)