Adds enemies
This commit is contained in:
parent
cf8ba8bacb
commit
76e5b1927f
324 changed files with 28447 additions and 106 deletions
34
demo/agents/01_agent_melee_simple.tscn
Normal file
34
demo/agents/01_agent_melee_simple.tscn
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
[gd_scene load_steps=5 format=3 uid="uid://1dnm7tuik8xo"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://ooigbfhfy4wa" path="res://demo/agents/agent_base.tscn" id="1_l180o"]
|
||||
[ext_resource type="Texture2D" uid="uid://cw8s50856x8ct" path="res://demo/assets/agent_melee_simple.png" id="2_bvbes"]
|
||||
[ext_resource type="BehaviorTree" uid="uid://bpdm5jnegi38" path="res://demo/ai/trees/01_agent_melee_simple.tres" id="3_tb7cx"]
|
||||
|
||||
[sub_resource type="BlackboardPlan" id="BlackboardPlan_s08ac"]
|
||||
|
||||
[node name="AgentMeleeSimple" instance=ExtResource("1_l180o")]
|
||||
|
||||
[node name="LegL" parent="Root/Rig" index="1"]
|
||||
texture = ExtResource("2_bvbes")
|
||||
|
||||
[node name="LegR" parent="Root/Rig" index="2"]
|
||||
texture = ExtResource("2_bvbes")
|
||||
|
||||
[node name="Body" parent="Root/Rig" index="3"]
|
||||
texture = ExtResource("2_bvbes")
|
||||
|
||||
[node name="Hat" parent="Root/Rig/Body" index="0"]
|
||||
texture = ExtResource("2_bvbes")
|
||||
|
||||
[node name="HandL" parent="Root/Rig/Body" index="1"]
|
||||
texture = ExtResource("2_bvbes")
|
||||
|
||||
[node name="HandR" parent="Root/Rig/Body" index="2"]
|
||||
texture = ExtResource("2_bvbes")
|
||||
|
||||
[node name="Health" parent="." index="3"]
|
||||
max_health = 3.0
|
||||
|
||||
[node name="BTPlayer" type="BTPlayer" parent="." index="5"]
|
||||
behavior_tree = ExtResource("3_tb7cx")
|
||||
blackboard_plan = SubResource("BlackboardPlan_s08ac")
|
||||
37
demo/agents/02_agent_charger.tscn
Normal file
37
demo/agents/02_agent_charger.tscn
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
[gd_scene load_steps=5 format=3 uid="uid://g1pnvanyxcpa"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://ooigbfhfy4wa" path="res://demo/agents/agent_base.tscn" id="1_n83hi"]
|
||||
[ext_resource type="Texture2D" uid="uid://ce16nc0wy2s8" path="res://demo/assets/agent_charger.png" id="2_y7pic"]
|
||||
[ext_resource type="BehaviorTree" uid="uid://ylife72ym5et" path="res://demo/ai/trees/02_agent_charger.tres" id="3_nacc3"]
|
||||
|
||||
[sub_resource type="BlackboardPlan" id="BlackboardPlan_pmyhf"]
|
||||
|
||||
[node name="AgentCharger" instance=ExtResource("1_n83hi")]
|
||||
|
||||
[node name="LegL" parent="Root/Rig" index="1"]
|
||||
texture = ExtResource("2_y7pic")
|
||||
|
||||
[node name="LegR" parent="Root/Rig" index="2"]
|
||||
texture = ExtResource("2_y7pic")
|
||||
|
||||
[node name="Body" parent="Root/Rig" index="3"]
|
||||
texture = ExtResource("2_y7pic")
|
||||
|
||||
[node name="Hat" parent="Root/Rig/Body" index="0"]
|
||||
texture = ExtResource("2_y7pic")
|
||||
|
||||
[node name="HandL" parent="Root/Rig/Body" index="1"]
|
||||
texture = ExtResource("2_y7pic")
|
||||
|
||||
[node name="HandR" parent="Root/Rig/Body" index="2"]
|
||||
texture = ExtResource("2_y7pic")
|
||||
|
||||
[node name="Hitbox" parent="Root" index="1"]
|
||||
damage = 2.0
|
||||
|
||||
[node name="Health" parent="." index="3"]
|
||||
max_health = 8.0
|
||||
|
||||
[node name="BTPlayer" type="BTPlayer" parent="." index="4"]
|
||||
behavior_tree = ExtResource("3_nacc3")
|
||||
blackboard_plan = SubResource("BlackboardPlan_pmyhf")
|
||||
34
demo/agents/03_agent_imp.tscn
Normal file
34
demo/agents/03_agent_imp.tscn
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
[gd_scene load_steps=5 format=3 uid="uid://730bthc0ywhd"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://ooigbfhfy4wa" path="res://demo/agents/agent_base.tscn" id="1_13xup"]
|
||||
[ext_resource type="Texture2D" uid="uid://h70okn6hmxum" path="res://demo/assets/agent_imp.png" id="2_xd5s8"]
|
||||
[ext_resource type="BehaviorTree" uid="uid://c2bxoo68ywb27" path="res://demo/ai/trees/03_agent_imp.tres" id="3_furh3"]
|
||||
|
||||
[sub_resource type="BlackboardPlan" id="BlackboardPlan_aog23"]
|
||||
|
||||
[node name="AgentImp" instance=ExtResource("1_13xup")]
|
||||
|
||||
[node name="LegL" parent="Root/Rig" index="1"]
|
||||
texture = ExtResource("2_xd5s8")
|
||||
|
||||
[node name="LegR" parent="Root/Rig" index="2"]
|
||||
texture = ExtResource("2_xd5s8")
|
||||
|
||||
[node name="Body" parent="Root/Rig" index="3"]
|
||||
texture = ExtResource("2_xd5s8")
|
||||
|
||||
[node name="Hat" parent="Root/Rig/Body" index="0"]
|
||||
texture = ExtResource("2_xd5s8")
|
||||
|
||||
[node name="HandL" parent="Root/Rig/Body" index="1"]
|
||||
texture = ExtResource("2_xd5s8")
|
||||
|
||||
[node name="HandR" parent="Root/Rig/Body" index="2"]
|
||||
texture = ExtResource("2_xd5s8")
|
||||
|
||||
[node name="Health" parent="." index="3"]
|
||||
max_health = 4.0
|
||||
|
||||
[node name="BTPlayer" type="BTPlayer" parent="." index="5"]
|
||||
behavior_tree = ExtResource("3_furh3")
|
||||
blackboard_plan = SubResource("BlackboardPlan_aog23")
|
||||
34
demo/agents/04_agent_skirmisher.tscn
Normal file
34
demo/agents/04_agent_skirmisher.tscn
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
[gd_scene load_steps=5 format=3 uid="uid://co6yeafaljbq0"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://ooigbfhfy4wa" path="res://demo/agents/agent_base.tscn" id="1_2ir76"]
|
||||
[ext_resource type="Texture2D" uid="uid://l042ovqqsy3l" path="res://demo/assets/agent_skirmisher.png" id="2_w8tqw"]
|
||||
[ext_resource type="BehaviorTree" uid="uid://qqmjvbeibatn" path="res://demo/ai/trees/04_agent_skirmisher.tres" id="3_bhfkv"]
|
||||
|
||||
[sub_resource type="BlackboardPlan" id="BlackboardPlan_vjbry"]
|
||||
|
||||
[node name="AgentSkirmisher" instance=ExtResource("1_2ir76")]
|
||||
|
||||
[node name="LegL" parent="Root/Rig" index="1"]
|
||||
texture = ExtResource("2_w8tqw")
|
||||
|
||||
[node name="LegR" parent="Root/Rig" index="2"]
|
||||
texture = ExtResource("2_w8tqw")
|
||||
|
||||
[node name="Body" parent="Root/Rig" index="3"]
|
||||
texture = ExtResource("2_w8tqw")
|
||||
|
||||
[node name="Hat" parent="Root/Rig/Body" index="0"]
|
||||
texture = ExtResource("2_w8tqw")
|
||||
|
||||
[node name="HandL" parent="Root/Rig/Body" index="1"]
|
||||
texture = ExtResource("2_w8tqw")
|
||||
|
||||
[node name="HandR" parent="Root/Rig/Body" index="2"]
|
||||
texture = ExtResource("2_w8tqw")
|
||||
|
||||
[node name="Health" parent="." index="3"]
|
||||
max_health = 7.0
|
||||
|
||||
[node name="BTPlayer" type="BTPlayer" parent="." index="4"]
|
||||
behavior_tree = ExtResource("3_bhfkv")
|
||||
blackboard_plan = SubResource("BlackboardPlan_vjbry")
|
||||
34
demo/agents/05_agent_ranged.tscn
Normal file
34
demo/agents/05_agent_ranged.tscn
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
[gd_scene load_steps=5 format=3 uid="uid://ci3x5esepbu5v"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://ooigbfhfy4wa" path="res://demo/agents/agent_base.tscn" id="1_oa4xm"]
|
||||
[ext_resource type="Texture2D" uid="uid://cjts4ennjtepg" path="res://demo/assets/agent_ranged.png" id="2_37lvn"]
|
||||
[ext_resource type="BehaviorTree" uid="uid://cqluon1y1hnn5" path="res://demo/ai/trees/05_agent_ranged.tres" id="3_f7r5w"]
|
||||
|
||||
[sub_resource type="BlackboardPlan" id="BlackboardPlan_2kwy7"]
|
||||
|
||||
[node name="AgentRanged" instance=ExtResource("1_oa4xm")]
|
||||
|
||||
[node name="LegL" parent="Root/Rig" index="1"]
|
||||
texture = ExtResource("2_37lvn")
|
||||
|
||||
[node name="LegR" parent="Root/Rig" index="2"]
|
||||
texture = ExtResource("2_37lvn")
|
||||
|
||||
[node name="Body" parent="Root/Rig" index="3"]
|
||||
texture = ExtResource("2_37lvn")
|
||||
|
||||
[node name="Hat" parent="Root/Rig/Body" index="0"]
|
||||
texture = ExtResource("2_37lvn")
|
||||
|
||||
[node name="HandL" parent="Root/Rig/Body" index="1"]
|
||||
texture = ExtResource("2_37lvn")
|
||||
|
||||
[node name="HandR" parent="Root/Rig/Body" index="2"]
|
||||
texture = ExtResource("2_37lvn")
|
||||
|
||||
[node name="Health" parent="." index="3"]
|
||||
max_health = 6.0
|
||||
|
||||
[node name="BTPlayer" type="BTPlayer" parent="." index="4"]
|
||||
behavior_tree = ExtResource("3_f7r5w")
|
||||
blackboard_plan = SubResource("BlackboardPlan_2kwy7")
|
||||
34
demo/agents/06_agent_melee_combo.tscn
Normal file
34
demo/agents/06_agent_melee_combo.tscn
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
[gd_scene load_steps=5 format=3 uid="uid://blxmw2w1h2s0s"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://ooigbfhfy4wa" path="res://demo/agents/agent_base.tscn" id="1_dny3b"]
|
||||
[ext_resource type="Texture2D" uid="uid://bo0ibp7tvjbba" path="res://demo/assets/agent_combo.png" id="2_4rqld"]
|
||||
[ext_resource type="BehaviorTree" uid="uid://cpncl1db8j12f" path="res://demo/ai/trees/06_agent_melee_combo.tres" id="3_l805q"]
|
||||
|
||||
[sub_resource type="BlackboardPlan" id="BlackboardPlan_67ric"]
|
||||
|
||||
[node name="AgentMeleeCombo" instance=ExtResource("1_dny3b")]
|
||||
|
||||
[node name="LegL" parent="Root/Rig" index="1"]
|
||||
texture = ExtResource("2_4rqld")
|
||||
|
||||
[node name="LegR" parent="Root/Rig" index="2"]
|
||||
texture = ExtResource("2_4rqld")
|
||||
|
||||
[node name="Body" parent="Root/Rig" index="3"]
|
||||
texture = ExtResource("2_4rqld")
|
||||
|
||||
[node name="Hat" parent="Root/Rig/Body" index="0"]
|
||||
texture = ExtResource("2_4rqld")
|
||||
|
||||
[node name="HandL" parent="Root/Rig/Body" index="1"]
|
||||
texture = ExtResource("2_4rqld")
|
||||
|
||||
[node name="HandR" parent="Root/Rig/Body" index="2"]
|
||||
texture = ExtResource("2_4rqld")
|
||||
|
||||
[node name="Health" parent="." index="3"]
|
||||
max_health = 6.0
|
||||
|
||||
[node name="BTPlayer" type="BTPlayer" parent="." index="4"]
|
||||
behavior_tree = ExtResource("3_l805q")
|
||||
blackboard_plan = SubResource("BlackboardPlan_67ric")
|
||||
34
demo/agents/07_agent_melee_nuanced.tscn
Normal file
34
demo/agents/07_agent_melee_nuanced.tscn
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
[gd_scene load_steps=5 format=3 uid="uid://2e4ohaqjaawb"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://ooigbfhfy4wa" path="res://demo/agents/agent_base.tscn" id="1_afx5l"]
|
||||
[ext_resource type="Texture2D" uid="uid://usu3j55d6dgc" path="res://demo/assets/agent_melee_nuanced.png" id="2_e51r0"]
|
||||
[ext_resource type="BehaviorTree" uid="uid://c2u6sljqkim0n" path="res://demo/ai/trees/07_agent_melee_nuanced.tres" id="3_b8kcf"]
|
||||
|
||||
[sub_resource type="BlackboardPlan" id="BlackboardPlan_tnf02"]
|
||||
|
||||
[node name="AgentMeleeNuanced" instance=ExtResource("1_afx5l")]
|
||||
|
||||
[node name="LegL" parent="Root/Rig" index="1"]
|
||||
texture = ExtResource("2_e51r0")
|
||||
|
||||
[node name="LegR" parent="Root/Rig" index="2"]
|
||||
texture = ExtResource("2_e51r0")
|
||||
|
||||
[node name="Body" parent="Root/Rig" index="3"]
|
||||
texture = ExtResource("2_e51r0")
|
||||
|
||||
[node name="Hat" parent="Root/Rig/Body" index="0"]
|
||||
texture = ExtResource("2_e51r0")
|
||||
|
||||
[node name="HandL" parent="Root/Rig/Body" index="1"]
|
||||
texture = ExtResource("2_e51r0")
|
||||
|
||||
[node name="HandR" parent="Root/Rig/Body" index="2"]
|
||||
texture = ExtResource("2_e51r0")
|
||||
|
||||
[node name="Health" parent="." index="3"]
|
||||
max_health = 6.0
|
||||
|
||||
[node name="BTPlayer" type="BTPlayer" parent="." index="4"]
|
||||
behavior_tree = ExtResource("3_b8kcf")
|
||||
blackboard_plan = SubResource("BlackboardPlan_tnf02")
|
||||
34
demo/agents/08_agent_demon.tscn
Normal file
34
demo/agents/08_agent_demon.tscn
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
[gd_scene load_steps=5 format=3 uid="uid://dbmcufef0cc4b"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://ooigbfhfy4wa" path="res://demo/agents/agent_base.tscn" id="1_115kp"]
|
||||
[ext_resource type="Texture2D" uid="uid://d1tx7u8ho0r4v" path="res://demo/assets/agent_demon.png" id="2_cb5f2"]
|
||||
[ext_resource type="BehaviorTree" uid="uid://cpcnbi81jqge4" path="res://demo/ai/trees/08_agent_demon.tres" id="3_ebd57"]
|
||||
|
||||
[sub_resource type="BlackboardPlan" id="BlackboardPlan_5sr4g"]
|
||||
|
||||
[node name="AgentDemon" instance=ExtResource("1_115kp")]
|
||||
|
||||
[node name="LegL" parent="Root/Rig" index="1"]
|
||||
texture = ExtResource("2_cb5f2")
|
||||
|
||||
[node name="LegR" parent="Root/Rig" index="2"]
|
||||
texture = ExtResource("2_cb5f2")
|
||||
|
||||
[node name="Body" parent="Root/Rig" index="3"]
|
||||
texture = ExtResource("2_cb5f2")
|
||||
|
||||
[node name="Hat" parent="Root/Rig/Body" index="0"]
|
||||
texture = ExtResource("2_cb5f2")
|
||||
|
||||
[node name="HandL" parent="Root/Rig/Body" index="1"]
|
||||
texture = ExtResource("2_cb5f2")
|
||||
|
||||
[node name="HandR" parent="Root/Rig/Body" index="2"]
|
||||
texture = ExtResource("2_cb5f2")
|
||||
|
||||
[node name="Health" parent="." index="3"]
|
||||
max_health = 8.0
|
||||
|
||||
[node name="BTPlayer" type="BTPlayer" parent="." index="5"]
|
||||
behavior_tree = ExtResource("3_ebd57")
|
||||
blackboard_plan = SubResource("BlackboardPlan_5sr4g")
|
||||
34
demo/agents/09_agent_summoner.tscn
Normal file
34
demo/agents/09_agent_summoner.tscn
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
[gd_scene load_steps=5 format=3 uid="uid://bycvi2fb0f7ue"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://ooigbfhfy4wa" path="res://demo/agents/agent_base.tscn" id="1_neifu"]
|
||||
[ext_resource type="Texture2D" uid="uid://ombnpn2edldt" path="res://demo/assets/agent_summoner.png" id="2_fcti4"]
|
||||
[ext_resource type="BehaviorTree" uid="uid://cpxk7jnqpwwlc" path="res://demo/ai/trees/09_agent_summoner.tres" id="3_bunpq"]
|
||||
|
||||
[sub_resource type="BlackboardPlan" id="BlackboardPlan_bqv3d"]
|
||||
|
||||
[node name="AgentSummoner" instance=ExtResource("1_neifu")]
|
||||
|
||||
[node name="LegL" parent="Root/Rig" index="1"]
|
||||
texture = ExtResource("2_fcti4")
|
||||
|
||||
[node name="LegR" parent="Root/Rig" index="2"]
|
||||
texture = ExtResource("2_fcti4")
|
||||
|
||||
[node name="Body" parent="Root/Rig" index="3"]
|
||||
texture = ExtResource("2_fcti4")
|
||||
|
||||
[node name="Hat" parent="Root/Rig/Body" index="0"]
|
||||
texture = ExtResource("2_fcti4")
|
||||
|
||||
[node name="HandL" parent="Root/Rig/Body" index="1"]
|
||||
texture = ExtResource("2_fcti4")
|
||||
|
||||
[node name="HandR" parent="Root/Rig/Body" index="2"]
|
||||
texture = ExtResource("2_fcti4")
|
||||
|
||||
[node name="Health" parent="." index="3"]
|
||||
max_health = 8.0
|
||||
|
||||
[node name="BTPlayer" type="BTPlayer" parent="." index="5"]
|
||||
behavior_tree = ExtResource("3_bunpq")
|
||||
blackboard_plan = SubResource("BlackboardPlan_bqv3d")
|
||||
4528
demo/agents/agent_base.tscn
Normal file
4528
demo/agents/agent_base.tscn
Normal file
File diff suppressed because it is too large
Load diff
56
demo/agents/fireball/fireball.gd
Normal file
56
demo/agents/fireball/fireball.gd
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
#*
|
||||
#* fireball.gd
|
||||
#* =============================================================================
|
||||
#* Copyright (c) 2023-present Serhii Snitsaruk and the LimboAI contributors.
|
||||
#*
|
||||
#* Use of this source code is governed by an MIT-style
|
||||
#* license that can be found in the LICENSE file or at
|
||||
#* https://opensource.org/licenses/MIT.
|
||||
#* =============================================================================
|
||||
#*
|
||||
extends Node2D
|
||||
## Fireball
|
||||
|
||||
const SPEED := 800.0
|
||||
const DEAD_SPEED := 400.0
|
||||
|
||||
@export var dir: float = 1.0
|
||||
|
||||
var _is_dead: bool = false
|
||||
|
||||
@onready var fireball_sprite: Sprite2D = $Root/Fireball
|
||||
@onready var death: GPUParticles2D = $FX/Death
|
||||
@onready var collision_shape_2d: CollisionShape2D = $Hitbox/CollisionShape2D
|
||||
@onready var root: Node2D = $Root
|
||||
@onready var trail: GPUParticles2D = $FX/Trail
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
var tween := create_tween().set_loops()
|
||||
tween.tween_property(fireball_sprite, ^"rotation", PI * signf(dir), 1.0).as_relative()
|
||||
|
||||
var tween2 := create_tween().set_trans(Tween.TRANS_QUAD).set_ease(Tween.EASE_IN)
|
||||
tween2.tween_property(fireball_sprite, "position:y", -10.0, 0.5).as_relative().set_ease(Tween.EASE_OUT)
|
||||
tween2.tween_property(fireball_sprite, "position:y", 0.0, 1.0)
|
||||
tween2.tween_callback(_die)
|
||||
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
var speed: float = SPEED if not _is_dead else DEAD_SPEED
|
||||
position += Vector2.RIGHT * speed * dir * delta
|
||||
|
||||
|
||||
func _die() -> void:
|
||||
if _is_dead:
|
||||
return
|
||||
_is_dead = true
|
||||
trail.emitting = false
|
||||
root.hide()
|
||||
collision_shape_2d.set_deferred(&"disabled", true)
|
||||
death.emitting = true
|
||||
await death.finished
|
||||
queue_free()
|
||||
|
||||
|
||||
func _on_hitbox_area_entered(_area: Area2D) -> void:
|
||||
_die()
|
||||
169
demo/agents/fireball/fireball.tscn
Normal file
169
demo/agents/fireball/fireball.tscn
Normal file
|
|
@ -0,0 +1,169 @@
|
|||
[gd_scene load_steps=18 format=3 uid="uid://wdauoepicegb"]
|
||||
|
||||
[ext_resource type="Script" path="res://demo/agents/fireball/fireball.gd" id="1_ituf4"]
|
||||
[ext_resource type="Texture2D" uid="uid://dwhhxj5557qrb" path="res://demo/assets/shadow.png" id="2_6n8mx"]
|
||||
[ext_resource type="Texture2D" uid="uid://235liwnxn1n5" path="res://demo/assets/fireball.png" id="3_1an0e"]
|
||||
[ext_resource type="Script" path="res://demo/agents/scripts/hitbox.gd" id="4_rjhgc"]
|
||||
[ext_resource type="Texture2D" uid="uid://bdusy0qqtw0th" path="res://demo/assets/smoke.png" id="5_dcbp6"]
|
||||
|
||||
[sub_resource type="Curve" id="Curve_mukra"]
|
||||
_data = [Vector2(0, 0), 0.0, 4.81319, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0]
|
||||
point_count = 2
|
||||
|
||||
[sub_resource type="CurveTexture" id="CurveTexture_56342"]
|
||||
curve = SubResource("Curve_mukra")
|
||||
|
||||
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_gbya7"]
|
||||
lifetime_randomness = 0.5
|
||||
particle_flag_disable_z = true
|
||||
direction = Vector3(0, -1, 0)
|
||||
spread = 90.0
|
||||
initial_velocity_min = 150.0
|
||||
initial_velocity_max = 250.0
|
||||
angular_velocity_min = -90.0
|
||||
angular_velocity_max = 90.0
|
||||
gravity = Vector3(0, 0, 0)
|
||||
radial_accel_min = -90.0
|
||||
radial_accel_max = 90.0
|
||||
damping_min = 200.0
|
||||
damping_max = 200.0
|
||||
scale_min = 0.8
|
||||
scale_max = 1.2
|
||||
scale_curve = SubResource("CurveTexture_56342")
|
||||
color = Color(0.552941, 0.552941, 0.552941, 1)
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_c08h3"]
|
||||
offsets = PackedFloat32Array(0, 0.549738, 1)
|
||||
colors = PackedColorArray(0.980453, 0.717632, 0.282353, 1, 0.960906, 0.211521, 0.0390784, 1, 0.201527, 0.201527, 0.201527, 1)
|
||||
|
||||
[sub_resource type="GradientTexture1D" id="GradientTexture1D_fhxvw"]
|
||||
gradient = SubResource("Gradient_c08h3")
|
||||
|
||||
[sub_resource type="Curve" id="Curve_ugmtv"]
|
||||
_data = [Vector2(0, 0.010989), 0.0, 0.0, 0, 0, Vector2(0.151111, 1), 1.3559, 1.3559, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0]
|
||||
point_count = 3
|
||||
|
||||
[sub_resource type="CurveTexture" id="CurveTexture_1f5jp"]
|
||||
curve = SubResource("Curve_ugmtv")
|
||||
|
||||
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_gilhy"]
|
||||
lifetime_randomness = 0.5
|
||||
particle_flag_disable_z = true
|
||||
emission_shape = 3
|
||||
emission_box_extents = Vector3(40, 1, 1)
|
||||
direction = Vector3(0, -1, 0)
|
||||
spread = 90.0
|
||||
initial_velocity_min = 150.0
|
||||
initial_velocity_max = 250.0
|
||||
angular_velocity_min = -90.0
|
||||
angular_velocity_max = 90.0
|
||||
gravity = Vector3(0, 0, 0)
|
||||
radial_accel_min = -90.0
|
||||
radial_accel_max = 90.0
|
||||
damping_min = 200.0
|
||||
damping_max = 200.0
|
||||
scale_min = 0.8
|
||||
scale_max = 1.2
|
||||
scale_curve = SubResource("CurveTexture_1f5jp")
|
||||
color_ramp = SubResource("GradientTexture1D_fhxvw")
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_7uc1b"]
|
||||
radius = 25.13
|
||||
|
||||
[sub_resource type="Animation" id="Animation_wr7y0"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Root/Fireball:frame")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [0]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_ey8it"]
|
||||
resource_name = "default"
|
||||
length = 0.3
|
||||
loop_mode = 1
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Root/Fireball:frame")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1),
|
||||
"update": 1,
|
||||
"values": [0, 1, 2, 0]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_cphpk"]
|
||||
_data = {
|
||||
"RESET": SubResource("Animation_wr7y0"),
|
||||
"default": SubResource("Animation_ey8it")
|
||||
}
|
||||
|
||||
[node name="Fireball" type="Node2D"]
|
||||
script = ExtResource("1_ituf4")
|
||||
|
||||
[node name="FX" type="Node2D" parent="."]
|
||||
position = Vector2(0, -92)
|
||||
|
||||
[node name="Trail" type="GPUParticles2D" parent="FX"]
|
||||
show_behind_parent = true
|
||||
amount = 6
|
||||
process_material = SubResource("ParticleProcessMaterial_gbya7")
|
||||
texture = ExtResource("5_dcbp6")
|
||||
lifetime = 0.4
|
||||
fixed_fps = 60
|
||||
|
||||
[node name="Death" type="GPUParticles2D" parent="FX"]
|
||||
emitting = false
|
||||
amount = 6
|
||||
process_material = SubResource("ParticleProcessMaterial_gilhy")
|
||||
texture = ExtResource("5_dcbp6")
|
||||
lifetime = 0.7
|
||||
one_shot = true
|
||||
explosiveness = 0.7
|
||||
fixed_fps = 60
|
||||
local_coords = true
|
||||
|
||||
[node name="Root" type="Node2D" parent="."]
|
||||
|
||||
[node name="Shadow" type="Sprite2D" parent="Root"]
|
||||
modulate = Color(1, 1, 1, 0.686275)
|
||||
position = Vector2(0, -1)
|
||||
scale = Vector2(0.382, 0.297)
|
||||
texture = ExtResource("2_6n8mx")
|
||||
|
||||
[node name="Fireball" type="Sprite2D" parent="Root"]
|
||||
position = Vector2(0, -92)
|
||||
texture = ExtResource("3_1an0e")
|
||||
hframes = 3
|
||||
|
||||
[node name="RemoteTransform2D" type="RemoteTransform2D" parent="Root/Fireball"]
|
||||
remote_path = NodePath("../../../FX")
|
||||
update_rotation = false
|
||||
update_scale = false
|
||||
|
||||
[node name="Hitbox" type="Area2D" parent="."]
|
||||
collision_layer = 0
|
||||
collision_mask = 4
|
||||
script = ExtResource("4_rjhgc")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Hitbox"]
|
||||
shape = SubResource("CircleShape2D_7uc1b")
|
||||
debug_color = Color(0.839216, 0.192157, 0.815686, 0.419608)
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
libraries = {
|
||||
"": SubResource("AnimationLibrary_cphpk")
|
||||
}
|
||||
autoplay = "default"
|
||||
|
||||
[connection signal="area_entered" from="Hitbox" to="." method="_on_hitbox_area_entered"]
|
||||
53
demo/agents/ninja_star/ninja_star.gd
Normal file
53
demo/agents/ninja_star/ninja_star.gd
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
#*
|
||||
#* ninja_star.gd
|
||||
#* =============================================================================
|
||||
#* Copyright (c) 2023-present Serhii Snitsaruk and the LimboAI contributors.
|
||||
#*
|
||||
#* Use of this source code is governed by an MIT-style
|
||||
#* license that can be found in the LICENSE file or at
|
||||
#* https://opensource.org/licenses/MIT.
|
||||
#* =============================================================================
|
||||
#*
|
||||
extends Node2D
|
||||
|
||||
const SPEED := 800.0
|
||||
const DEAD_SPEED := 400.0
|
||||
|
||||
@export var dir: float = 1.0
|
||||
|
||||
var _is_dead: bool = false
|
||||
|
||||
@onready var ninja_star: Sprite2D = $Root/NinjaStar
|
||||
@onready var death: GPUParticles2D = $Death
|
||||
@onready var collision_shape_2d: CollisionShape2D = $Hitbox/CollisionShape2D
|
||||
@onready var root: Node2D = $Root
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
var tween := create_tween().set_loops()
|
||||
tween.tween_property(ninja_star, ^"rotation", TAU * signf(dir), 1.0).as_relative()
|
||||
|
||||
var tween2 := create_tween().set_trans(Tween.TRANS_QUAD).set_ease(Tween.EASE_IN)
|
||||
tween2.tween_property(ninja_star, "position:y", -10.0, 0.5).as_relative().set_ease(Tween.EASE_OUT)
|
||||
tween2.tween_property(ninja_star, "position:y", 0.0, 1.0)
|
||||
tween2.tween_callback(_die)
|
||||
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
var speed: float = SPEED if not _is_dead else DEAD_SPEED
|
||||
position += Vector2.RIGHT * speed * dir * delta
|
||||
|
||||
|
||||
func _die() -> void:
|
||||
if _is_dead:
|
||||
return
|
||||
_is_dead = true
|
||||
root.hide()
|
||||
collision_shape_2d.set_deferred(&"disabled", true)
|
||||
death.emitting = true
|
||||
await death.finished
|
||||
queue_free()
|
||||
|
||||
|
||||
func _on_hitbox_area_entered(_area: Area2D) -> void:
|
||||
_die()
|
||||
80
demo/agents/ninja_star/ninja_star.tscn
Normal file
80
demo/agents/ninja_star/ninja_star.tscn
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
[gd_scene load_steps=10 format=3 uid="uid://bj5n72nomeaci"]
|
||||
|
||||
[ext_resource type="Script" path="res://demo/agents/ninja_star/ninja_star.gd" id="1_pja57"]
|
||||
[ext_resource type="Texture2D" uid="uid://2uyxh7sy8qny" path="res://demo/assets/weapon_ninja_star.png" id="1_ptof7"]
|
||||
[ext_resource type="Texture2D" uid="uid://dwhhxj5557qrb" path="res://demo/assets/shadow.png" id="2_2rj5a"]
|
||||
[ext_resource type="Script" path="res://demo/agents/scripts/hitbox.gd" id="2_iem02"]
|
||||
[ext_resource type="Texture2D" uid="uid://bdusy0qqtw0th" path="res://demo/assets/smoke.png" id="5_t37aw"]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_7uc1b"]
|
||||
radius = 28.0
|
||||
|
||||
[sub_resource type="Curve" id="Curve_ugmtv"]
|
||||
_data = [Vector2(0, 0.010989), 0.0, 0.0, 0, 0, Vector2(0.151111, 1), 1.3559, 1.3559, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0]
|
||||
point_count = 3
|
||||
|
||||
[sub_resource type="CurveTexture" id="CurveTexture_1f5jp"]
|
||||
curve = SubResource("Curve_ugmtv")
|
||||
|
||||
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_gilhy"]
|
||||
lifetime_randomness = 0.5
|
||||
particle_flag_disable_z = true
|
||||
emission_shape = 3
|
||||
emission_box_extents = Vector3(40, 1, 1)
|
||||
direction = Vector3(0, -1, 0)
|
||||
spread = 90.0
|
||||
initial_velocity_min = 150.0
|
||||
initial_velocity_max = 250.0
|
||||
angular_velocity_min = -90.0
|
||||
angular_velocity_max = 90.0
|
||||
gravity = Vector3(0, 0, 0)
|
||||
radial_accel_min = -90.0
|
||||
radial_accel_max = 90.0
|
||||
damping_min = 200.0
|
||||
damping_max = 200.0
|
||||
scale_min = 0.8
|
||||
scale_max = 1.2
|
||||
scale_curve = SubResource("CurveTexture_1f5jp")
|
||||
|
||||
[node name="NinjaStar" type="Node2D"]
|
||||
script = ExtResource("1_pja57")
|
||||
|
||||
[node name="Root" type="Node2D" parent="."]
|
||||
|
||||
[node name="Shadow" type="Sprite2D" parent="Root"]
|
||||
modulate = Color(1, 1, 1, 0.686275)
|
||||
position = Vector2(0, -1)
|
||||
scale = Vector2(0.382, 0.297)
|
||||
texture = ExtResource("2_2rj5a")
|
||||
|
||||
[node name="NinjaStar" type="Sprite2D" parent="Root"]
|
||||
position = Vector2(0, -93)
|
||||
texture = ExtResource("1_ptof7")
|
||||
|
||||
[node name="RemoteTransform2D" type="RemoteTransform2D" parent="Root/NinjaStar"]
|
||||
remote_path = NodePath("../../../Death")
|
||||
update_rotation = false
|
||||
update_scale = false
|
||||
|
||||
[node name="Hitbox" type="Area2D" parent="."]
|
||||
collision_layer = 0
|
||||
collision_mask = 4
|
||||
script = ExtResource("2_iem02")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Hitbox"]
|
||||
shape = SubResource("CircleShape2D_7uc1b")
|
||||
debug_color = Color(0.839216, 0.192157, 0.815686, 0.419608)
|
||||
|
||||
[node name="Death" type="GPUParticles2D" parent="."]
|
||||
position = Vector2(0, -93)
|
||||
emitting = false
|
||||
amount = 1
|
||||
process_material = SubResource("ParticleProcessMaterial_gilhy")
|
||||
texture = ExtResource("5_t37aw")
|
||||
lifetime = 0.7
|
||||
one_shot = true
|
||||
explosiveness = 0.7
|
||||
fixed_fps = 60
|
||||
local_coords = true
|
||||
|
||||
[connection signal="area_entered" from="Hitbox" to="." method="_on_hitbox_area_entered"]
|
||||
103
demo/agents/player/player.gd
Normal file
103
demo/agents/player/player.gd
Normal file
|
|
@ -0,0 +1,103 @@
|
|||
#*
|
||||
#* player.gd
|
||||
#* =============================================================================
|
||||
#* Copyright (c) 2023-present Serhii Snitsaruk and the LimboAI contributors.
|
||||
#*
|
||||
#* Use of this source code is governed by an MIT-style
|
||||
#* license that can be found in the LICENSE file or at
|
||||
#* https://opensource.org/licenses/MIT.
|
||||
#* =============================================================================
|
||||
#*
|
||||
extends "res://demo/agents/scripts/agent_base.gd"
|
||||
|
||||
## Player.
|
||||
|
||||
@export var dodge_cooldown: float = 0.4
|
||||
|
||||
@onready var hsm: LimboHSM = $LimboHSM
|
||||
@onready var idle_state: LimboState = $LimboHSM/IdleState
|
||||
@onready var move_state: LimboState = $LimboHSM/MoveState
|
||||
@onready var attack_state: LimboState = $LimboHSM/AttackState
|
||||
@onready var dodge_state: LimboState = $LimboHSM/DodgeState
|
||||
|
||||
var can_dodge: bool = true
|
||||
var attack_pressed: bool = false
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
super._ready()
|
||||
can_dodge = true
|
||||
_init_input_events()
|
||||
_init_state_machine()
|
||||
death.connect(func(): remove_from_group(&"player"))
|
||||
|
||||
|
||||
func _unhandled_input(event: InputEvent) -> void:
|
||||
if event.is_echo():
|
||||
return
|
||||
if event.is_action_pressed("attack"):
|
||||
attack_pressed = true
|
||||
_process_attack_input()
|
||||
if event.is_action_pressed("dodge"):
|
||||
hsm.dispatch("dodge!")
|
||||
|
||||
|
||||
func _process_attack_input() -> void:
|
||||
if not attack_pressed or hsm.get_active_state() == attack_state:
|
||||
return
|
||||
hsm.dispatch("attack!")
|
||||
attack_pressed = false
|
||||
|
||||
|
||||
func _init_state_machine() -> void:
|
||||
hsm.add_transition(idle_state, move_state, idle_state.EVENT_FINISHED)
|
||||
hsm.add_transition(move_state, idle_state, move_state.EVENT_FINISHED)
|
||||
hsm.add_transition(idle_state, attack_state, "attack!")
|
||||
hsm.add_transition(move_state, attack_state, "attack!")
|
||||
hsm.add_transition(attack_state, move_state, attack_state.EVENT_FINISHED)
|
||||
hsm.add_transition(hsm.ANYSTATE, dodge_state, "dodge!")
|
||||
hsm.add_transition(dodge_state, move_state, dodge_state.EVENT_FINISHED)
|
||||
|
||||
dodge_state.set_guard(_can_dodge)
|
||||
attack_state.set_guard(attack_state.can_enter)
|
||||
|
||||
# Process attack input buffer when move_state is entered.
|
||||
# This way we can buffer the attack button presses and chain the attacks.
|
||||
move_state.call_on_enter(_process_attack_input)
|
||||
|
||||
hsm.initialize(self)
|
||||
hsm.set_active(true)
|
||||
|
||||
|
||||
func _init_input_events() -> void:
|
||||
# Note: Ensures that input events are present even if project.godot wasn't imported.
|
||||
_add_action(&"move_left", KEY_A)
|
||||
_add_action(&"move_right", KEY_D)
|
||||
_add_action(&"move_up", KEY_W)
|
||||
_add_action(&"move_down", KEY_S)
|
||||
_add_action(&"dodge", KEY_SPACE)
|
||||
_add_action(&"attack", KEY_ENTER, KEY_F)
|
||||
|
||||
|
||||
func _add_action(p_action: StringName, p_key: Key, p_alt: Key = KEY_NONE) -> void:
|
||||
if not InputMap.has_action(p_action):
|
||||
InputMap.add_action(p_action)
|
||||
var event := InputEventKey.new()
|
||||
event.keycode = p_key
|
||||
InputMap.action_add_event(p_action, event)
|
||||
if p_alt != KEY_NONE:
|
||||
var alt := InputEventKey.new()
|
||||
alt.keycode = p_alt
|
||||
InputMap.action_add_event(p_action, alt)
|
||||
|
||||
|
||||
func set_victorious() -> void:
|
||||
idle_state.idle_animation = &"dance"
|
||||
|
||||
|
||||
func _can_dodge() -> bool:
|
||||
if can_dodge:
|
||||
can_dodge = false
|
||||
get_tree().create_timer(dodge_cooldown).timeout.connect(func(): can_dodge = true)
|
||||
return true
|
||||
return false
|
||||
53
demo/agents/player/player.tscn
Normal file
53
demo/agents/player/player.tscn
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
[gd_scene load_steps=8 format=3 uid="uid://d07ag5dcje13i"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://ooigbfhfy4wa" path="res://demo/agents/agent_base.tscn" id="1_mswd4"]
|
||||
[ext_resource type="Script" path="res://demo/agents/player/player.gd" id="2_24nyi"]
|
||||
[ext_resource type="Script" path="res://demo/agents/player/states/idle_state.gd" id="3_ekb12"]
|
||||
[ext_resource type="Script" path="res://demo/agents/player/states/move_state.gd" id="4_paikn"]
|
||||
[ext_resource type="Script" path="res://demo/agents/player/states/attack_state.gd" id="5_mpgu6"]
|
||||
[ext_resource type="Script" path="res://demo/agents/player/states/dodge_state.gd" id="6_7o4a6"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_8pofm"]
|
||||
size = Vector2(150, 50)
|
||||
|
||||
[node name="Player" groups=["player"] instance=ExtResource("1_mswd4")]
|
||||
collision_layer = 0
|
||||
collision_mask = 1
|
||||
script = ExtResource("2_24nyi")
|
||||
dodge_cooldown = 0.4
|
||||
|
||||
[node name="Hitbox" parent="Root" index="1"]
|
||||
collision_mask = 8
|
||||
|
||||
[node name="HitboxCollisionShape2D" parent="Root/Hitbox" index="0"]
|
||||
shape = SubResource("RectangleShape2D_8pofm")
|
||||
|
||||
[node name="Hurtbox" parent="Root" index="2"]
|
||||
collision_layer = 4
|
||||
|
||||
[node name="Health" parent="." index="3"]
|
||||
max_health = 30.0
|
||||
|
||||
[node name="LimboHSM" type="LimboHSM" parent="." index="4"]
|
||||
|
||||
[node name="IdleState" type="LimboState" parent="LimboHSM" index="0" node_paths=PackedStringArray("animation_player")]
|
||||
script = ExtResource("3_ekb12")
|
||||
animation_player = NodePath("../../AnimationPlayer")
|
||||
idle_animation = &"idle"
|
||||
|
||||
[node name="MoveState" type="LimboState" parent="LimboHSM" index="1" node_paths=PackedStringArray("animation_player")]
|
||||
script = ExtResource("4_paikn")
|
||||
animation_player = NodePath("../../AnimationPlayer")
|
||||
animation = &"walk"
|
||||
|
||||
[node name="AttackState" type="LimboState" parent="LimboHSM" index="2" node_paths=PackedStringArray("animation_player", "hitbox")]
|
||||
script = ExtResource("5_mpgu6")
|
||||
animation_player = NodePath("../../AnimationPlayer")
|
||||
animations = Array[StringName]([&"attack_1", &"attack_2", &"attack_3"])
|
||||
hitbox = NodePath("../../Root/Hitbox")
|
||||
|
||||
[node name="DodgeState" type="LimboState" parent="LimboHSM" index="3" node_paths=PackedStringArray("animation_player", "hurtbox_collision")]
|
||||
script = ExtResource("6_7o4a6")
|
||||
animation_player = NodePath("../../AnimationPlayer")
|
||||
animation = &"dodge"
|
||||
hurtbox_collision = NodePath("../../Root/Hurtbox/HurtboxCollisionShape2D")
|
||||
60
demo/agents/player/states/attack_state.gd
Normal file
60
demo/agents/player/states/attack_state.gd
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
#*
|
||||
#* attack_state.gd
|
||||
#* =============================================================================
|
||||
#* Copyright (c) 2023-present Serhii Snitsaruk and the LimboAI contributors.
|
||||
#*
|
||||
#* Use of this source code is governed by an MIT-style
|
||||
#* license that can be found in the LICENSE file or at
|
||||
#* https://opensource.org/licenses/MIT.
|
||||
#* =============================================================================
|
||||
#*
|
||||
extends LimboState
|
||||
|
||||
## Attack state: Perform 3-part combo attack for as long as player hits attack button.
|
||||
|
||||
@export var animation_player: AnimationPlayer
|
||||
@export var animations: Array[StringName]
|
||||
@export var hitbox: Hitbox
|
||||
|
||||
## Cooldown duration after third attack in the combo is complete.
|
||||
@export var combo_cooldown: float = 0.1
|
||||
|
||||
var anim_index: int = 0
|
||||
var last_attack_msec: int = -10000
|
||||
var _can_enter: bool = true
|
||||
|
||||
|
||||
## This func is used to prevent entering this state using LimboState.set_guard().
|
||||
## Entry is denied for a short duration after the third attack in the combo is complete.
|
||||
func can_enter() -> bool:
|
||||
return _can_enter
|
||||
|
||||
|
||||
func _enter() -> void:
|
||||
if (Time.get_ticks_msec() - last_attack_msec) < 200:
|
||||
# Perform next attack animation in the 3-part combo, if an attack was recently performed.
|
||||
anim_index = (anim_index + 1) % 3
|
||||
else:
|
||||
anim_index = 0
|
||||
|
||||
var horizontal_move: float = Input.get_axis(&"move_left", &"move_right")
|
||||
if not is_zero_approx(horizontal_move):
|
||||
agent.face_dir(horizontal_move)
|
||||
|
||||
hitbox.damage = 2 if anim_index == 2 else 1 # deal 2 damage on a third attack in the combo
|
||||
animation_player.play(animations[anim_index])
|
||||
|
||||
await animation_player.animation_finished
|
||||
if is_active():
|
||||
get_root().dispatch(EVENT_FINISHED)
|
||||
|
||||
|
||||
func _exit() -> void:
|
||||
hitbox.damage = 1
|
||||
last_attack_msec = Time.get_ticks_msec()
|
||||
if anim_index == 2 and _can_enter:
|
||||
# Prevent entering this state for a short duration after the third attack
|
||||
# in the combo sequence is complete.
|
||||
_can_enter = false
|
||||
await get_tree().create_timer(combo_cooldown).timeout
|
||||
_can_enter = true
|
||||
48
demo/agents/player/states/dodge_state.gd
Normal file
48
demo/agents/player/states/dodge_state.gd
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
#*
|
||||
#* dodge_state.gd
|
||||
#* =============================================================================
|
||||
#* Copyright (c) 2023-present Serhii Snitsaruk and the LimboAI contributors.
|
||||
#*
|
||||
#* Use of this source code is governed by an MIT-style
|
||||
#* license that can be found in the LICENSE file or at
|
||||
#* https://opensource.org/licenses/MIT.
|
||||
#* =============================================================================
|
||||
#*
|
||||
extends LimboState
|
||||
## Dodge state.
|
||||
|
||||
|
||||
@export var animation_player: AnimationPlayer
|
||||
@export var animation: StringName
|
||||
@export var duration: float = 0.4
|
||||
@export var dodge_speed: float = 1000.0
|
||||
@export var hurtbox_collision: CollisionShape2D
|
||||
|
||||
var move_dir: Vector2
|
||||
var elapsed_time: float
|
||||
|
||||
|
||||
func _enter() -> void:
|
||||
elapsed_time = 0.0
|
||||
hurtbox_collision.disabled = true
|
||||
|
||||
var horizontal_move: float = Input.get_axis(&"move_left", &"move_right")
|
||||
if is_zero_approx(horizontal_move):
|
||||
move_dir = Vector2.RIGHT * agent.get_facing()
|
||||
else:
|
||||
move_dir = Vector2.RIGHT * signf(horizontal_move)
|
||||
agent.face_dir(move_dir.x)
|
||||
|
||||
animation_player.play(animation, 0.1)
|
||||
|
||||
|
||||
func _exit() -> void:
|
||||
hurtbox_collision.set_deferred(&"disabled", false)
|
||||
|
||||
|
||||
func _update(p_delta: float) -> void:
|
||||
elapsed_time += p_delta
|
||||
var desired_velocity: Vector2 = move_dir * dodge_speed
|
||||
agent.move(desired_velocity)
|
||||
if elapsed_time > duration:
|
||||
get_root().dispatch(EVENT_FINISHED)
|
||||
27
demo/agents/player/states/idle_state.gd
Normal file
27
demo/agents/player/states/idle_state.gd
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
#*
|
||||
#* idle_state.gd
|
||||
#* =============================================================================
|
||||
#* Copyright (c) 2023-present Serhii Snitsaruk and the LimboAI contributors.
|
||||
#*
|
||||
#* Use of this source code is governed by an MIT-style
|
||||
#* license that can be found in the LICENSE file or at
|
||||
#* https://opensource.org/licenses/MIT.
|
||||
#* =============================================================================
|
||||
#*
|
||||
extends LimboState
|
||||
## Idle state.
|
||||
|
||||
|
||||
@export var animation_player: AnimationPlayer
|
||||
@export var idle_animation: StringName
|
||||
|
||||
|
||||
func _enter() -> void:
|
||||
animation_player.play(idle_animation, 0.1)
|
||||
|
||||
|
||||
func _update(_delta: float) -> void:
|
||||
var horizontal_move: float = Input.get_axis(&"move_left", &"move_right")
|
||||
var vertical_move: float = Input.get_axis(&"move_up", &"move_down")
|
||||
if horizontal_move != 0.0 or vertical_move != 0.0:
|
||||
get_root().dispatch(EVENT_FINISHED)
|
||||
37
demo/agents/player/states/move_state.gd
Normal file
37
demo/agents/player/states/move_state.gd
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
#*
|
||||
#* move_state.gd
|
||||
#* =============================================================================
|
||||
#* Copyright (c) 2023-present Serhii Snitsaruk and the LimboAI contributors.
|
||||
#*
|
||||
#* Use of this source code is governed by an MIT-style
|
||||
#* license that can be found in the LICENSE file or at
|
||||
#* https://opensource.org/licenses/MIT.
|
||||
#* =============================================================================
|
||||
#*
|
||||
extends LimboState
|
||||
## Move state.
|
||||
|
||||
|
||||
const VERTICAL_FACTOR := 0.8
|
||||
|
||||
@export var animation_player: AnimationPlayer
|
||||
@export var animation: StringName
|
||||
@export var speed: float = 500.0
|
||||
|
||||
|
||||
func _enter() -> void:
|
||||
animation_player.play(animation, 0.1)
|
||||
|
||||
|
||||
func _update(_delta: float) -> void:
|
||||
var horizontal_move: float = Input.get_axis(&"move_left", &"move_right")
|
||||
var vertical_move: float = Input.get_axis(&"move_up", &"move_down")
|
||||
|
||||
if not is_zero_approx(horizontal_move):
|
||||
agent.face_dir(horizontal_move)
|
||||
|
||||
var desired_velocity := Vector2(horizontal_move, vertical_move * VERTICAL_FACTOR) * speed
|
||||
agent.move(desired_velocity)
|
||||
|
||||
if horizontal_move == 0.0 and vertical_move == 0.0:
|
||||
get_root().dispatch(EVENT_FINISHED)
|
||||
161
demo/agents/scripts/agent_base.gd
Normal file
161
demo/agents/scripts/agent_base.gd
Normal file
|
|
@ -0,0 +1,161 @@
|
|||
#*
|
||||
#* agent_base.gd
|
||||
#* =============================================================================
|
||||
#* Copyright (c) 2023-present Serhii Snitsaruk and the LimboAI contributors.
|
||||
#*
|
||||
#* Use of this source code is governed by an MIT-style
|
||||
#* license that can be found in the LICENSE file or at
|
||||
#* https://opensource.org/licenses/MIT.
|
||||
#* =============================================================================
|
||||
#*
|
||||
extends CharacterBody2D
|
||||
## Base agent script that is shared by all agents.
|
||||
|
||||
signal death
|
||||
|
||||
# Resource file to use in summon_minion() method.
|
||||
const MINION_RESOURCE := "res://demo/agents/03_agent_imp.tscn"
|
||||
|
||||
# Projectile resource.
|
||||
const NinjaStar := preload("res://demo/agents/ninja_star/ninja_star.tscn")
|
||||
const Fireball := preload("res://demo/agents/fireball/fireball.tscn")
|
||||
|
||||
var summon_count: int = 0
|
||||
|
||||
var _frames_since_facing_update: int = 0
|
||||
var _is_dead: bool = false
|
||||
var _moved_this_frame: bool = false
|
||||
|
||||
@onready var animation_player: AnimationPlayer = $AnimationPlayer
|
||||
@onready var health: Health = $Health
|
||||
@onready var root: Node2D = $Root
|
||||
@onready var collision_shape_2d: CollisionShape2D = $CollisionShape2D
|
||||
@onready var summoning_effect: GPUParticles2D = $FX/Summoned
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
health.damaged.connect(_damaged)
|
||||
health.death.connect(die)
|
||||
|
||||
|
||||
func _physics_process(_delta: float) -> void:
|
||||
_post_physics_process.call_deferred()
|
||||
|
||||
|
||||
func _post_physics_process() -> void:
|
||||
if not _moved_this_frame:
|
||||
velocity = lerp(velocity, Vector2.ZERO, 0.5)
|
||||
_moved_this_frame = false
|
||||
|
||||
|
||||
func move(p_velocity: Vector2) -> void:
|
||||
velocity = lerp(velocity, p_velocity, 0.2)
|
||||
move_and_slide()
|
||||
_moved_this_frame = true
|
||||
|
||||
|
||||
## Update agent's facing in the velocity direction.
|
||||
func update_facing() -> void:
|
||||
_frames_since_facing_update += 1
|
||||
if _frames_since_facing_update > 3:
|
||||
face_dir(velocity.x)
|
||||
|
||||
## Face specified direction.
|
||||
func face_dir(dir: float) -> void:
|
||||
if dir > 0.0 and root.scale.x < 0.0:
|
||||
root.scale.x = 1.0;
|
||||
_frames_since_facing_update = 0
|
||||
if dir < 0.0 and root.scale.x > 0.0:
|
||||
root.scale.x = -1.0;
|
||||
_frames_since_facing_update = 0
|
||||
|
||||
## Returns 1.0 when agent is facing right.
|
||||
## Returns -1.0 when agent is facing left.
|
||||
func get_facing() -> float:
|
||||
return signf(root.scale.x)
|
||||
|
||||
|
||||
func throw_ninja_star() -> void:
|
||||
var ninja_star := NinjaStar.instantiate()
|
||||
ninja_star.dir = get_facing()
|
||||
get_parent().add_child(ninja_star)
|
||||
ninja_star.global_position = global_position + Vector2.RIGHT * 100.0 * get_facing()
|
||||
|
||||
|
||||
func spit_fire() -> void:
|
||||
var fireball := Fireball.instantiate()
|
||||
fireball.dir = get_facing()
|
||||
get_parent().add_child(fireball)
|
||||
fireball.global_position = global_position + Vector2.RIGHT * 100.0 * get_facing()
|
||||
|
||||
|
||||
func summon_minion(p_position: Vector2) -> void:
|
||||
var minion: CharacterBody2D = load(MINION_RESOURCE).instantiate()
|
||||
get_parent().add_child(minion)
|
||||
minion.position = p_position
|
||||
minion.play_summoning_effect()
|
||||
summon_count += 1
|
||||
minion.death.connect(func(): summon_count -= 1)
|
||||
|
||||
|
||||
## Method is used when this agent is summoned from the dungeons of the castle AaaAaaAAAAAaaAAaaaaaa
|
||||
func play_summoning_effect() -> void:
|
||||
summoning_effect.emitting = true
|
||||
|
||||
|
||||
## Is specified position inside the arena (not inside an obstacle)?
|
||||
func is_good_position(p_position: Vector2) -> bool:
|
||||
var space_state := get_world_2d().direct_space_state
|
||||
var params := PhysicsPointQueryParameters2D.new()
|
||||
params.position = p_position
|
||||
params.collision_mask = 1 # Obstacle layer has value 1
|
||||
var collision := space_state.intersect_point(params)
|
||||
return collision.is_empty()
|
||||
|
||||
|
||||
## When agent is damaged...
|
||||
func _damaged(_amount: float, knockback: Vector2) -> void:
|
||||
apply_knockback(knockback)
|
||||
animation_player.play(&"hurt")
|
||||
var btplayer := get_node_or_null(^"BTPlayer") as BTPlayer
|
||||
if btplayer:
|
||||
btplayer.set_active(false)
|
||||
var hsm := get_node_or_null(^"LimboHSM")
|
||||
if hsm:
|
||||
hsm.set_active(false)
|
||||
await animation_player.animation_finished
|
||||
if btplayer and not _is_dead:
|
||||
btplayer.restart()
|
||||
if hsm and not _is_dead:
|
||||
hsm.set_active(true)
|
||||
|
||||
|
||||
## Push agent in the knockback direction for the specified number of physics frames.
|
||||
func apply_knockback(knockback: Vector2, frames: int = 10) -> void:
|
||||
if knockback.is_zero_approx():
|
||||
return
|
||||
for i in range(frames):
|
||||
move(knockback)
|
||||
await get_tree().physics_frame
|
||||
|
||||
|
||||
func die() -> void:
|
||||
if _is_dead:
|
||||
return
|
||||
death.emit()
|
||||
_is_dead = true
|
||||
root.process_mode = Node.PROCESS_MODE_DISABLED
|
||||
animation_player.play(&"death")
|
||||
collision_shape_2d.set_deferred(&"disabled", true)
|
||||
|
||||
for child in get_children():
|
||||
if child is BTPlayer or child is LimboHSM:
|
||||
child.set_active(false)
|
||||
|
||||
if get_tree():
|
||||
await get_tree().create_timer(10.0).timeout
|
||||
queue_free()
|
||||
|
||||
|
||||
func get_health() -> Health:
|
||||
return health
|
||||
46
demo/agents/scripts/health.gd
Normal file
46
demo/agents/scripts/health.gd
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
#*
|
||||
#* health.gd
|
||||
#* =============================================================================
|
||||
#* Copyright (c) 2023-present Serhii Snitsaruk and the LimboAI contributors.
|
||||
#*
|
||||
#* Use of this source code is governed by an MIT-style
|
||||
#* license that can be found in the LICENSE file or at
|
||||
#* https://opensource.org/licenses/MIT.
|
||||
#* =============================================================================
|
||||
#*
|
||||
class_name Health
|
||||
extends Node
|
||||
## Tracks health and emits signal when damaged or dead.
|
||||
|
||||
## Emitted when health is reduced to 0.
|
||||
signal death
|
||||
|
||||
## Emitted when health is damaged.
|
||||
signal damaged(amount: float, knockback: Vector2)
|
||||
|
||||
## Initial health value.
|
||||
@export var max_health: float = 10.0
|
||||
|
||||
var _current: float
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
_current = max_health
|
||||
|
||||
|
||||
func take_damage(amount: float, knockback: Vector2) -> void:
|
||||
if _current <= 0.0:
|
||||
return
|
||||
|
||||
_current -= amount
|
||||
_current = max(_current, 0.0)
|
||||
|
||||
if _current <= 0.0:
|
||||
death.emit()
|
||||
else:
|
||||
damaged.emit(amount, knockback)
|
||||
|
||||
|
||||
## Returns current health.
|
||||
func get_current() -> float:
|
||||
return _current
|
||||
39
demo/agents/scripts/hitbox.gd
Normal file
39
demo/agents/scripts/hitbox.gd
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
#*
|
||||
#* hitbox.gd
|
||||
#* =============================================================================
|
||||
#* Copyright (c) 2023-present Serhii Snitsaruk and the LimboAI contributors.
|
||||
#*
|
||||
#* Use of this source code is governed by an MIT-style
|
||||
#* license that can be found in the LICENSE file or at
|
||||
#* https://opensource.org/licenses/MIT.
|
||||
#* =============================================================================
|
||||
#*
|
||||
class_name Hitbox
|
||||
extends Area2D
|
||||
## Area that deals damage.
|
||||
|
||||
## Damage value to apply.
|
||||
@export var damage: float = 1.0
|
||||
|
||||
## Push back the victim.
|
||||
@export var knockback_enabled: bool = false
|
||||
|
||||
## Desired pushback speed.
|
||||
@export var knockback_strength: float = 500.0
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
area_entered.connect(_area_entered)
|
||||
|
||||
|
||||
func _area_entered(hurtbox: Hurtbox) -> void:
|
||||
if hurtbox.owner == owner:
|
||||
return
|
||||
hurtbox.take_damage(damage, get_knockback(), self)
|
||||
|
||||
|
||||
func get_knockback() -> Vector2:
|
||||
var knockback: Vector2
|
||||
if knockback_enabled:
|
||||
knockback = Vector2.RIGHT.rotated(global_rotation) * knockback_strength
|
||||
return knockback
|
||||
22
demo/agents/scripts/hurtbox.gd
Normal file
22
demo/agents/scripts/hurtbox.gd
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
#*
|
||||
#* hurtbox.gd
|
||||
#* =============================================================================
|
||||
#* Copyright (c) 2023-present Serhii Snitsaruk and the LimboAI contributors.
|
||||
#*
|
||||
#* Use of this source code is governed by an MIT-style
|
||||
#* license that can be found in the LICENSE file or at
|
||||
#* https://opensource.org/licenses/MIT.
|
||||
#* =============================================================================
|
||||
#*
|
||||
class_name Hurtbox
|
||||
extends Area2D
|
||||
## Area that registers damage.
|
||||
|
||||
@export var health: Health
|
||||
|
||||
var last_attack_vector: Vector2
|
||||
|
||||
|
||||
func take_damage(amount: float, knockback: Vector2, source: Hitbox) -> void:
|
||||
last_attack_vector = owner.global_position - source.owner.global_position
|
||||
health.take_damage(amount, knockback)
|
||||
31
demo/agents/tutorial/tutorial_01_welcome.tscn
Normal file
31
demo/agents/tutorial/tutorial_01_welcome.tscn
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
[gd_scene load_steps=5 format=3 uid="uid://dk67yawiu33jv"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://ooigbfhfy4wa" path="res://demo/agents/agent_base.tscn" id="1_2vrmp"]
|
||||
[ext_resource type="Texture2D" uid="uid://b0oeqsc0xksto" path="res://demo/assets/agent_junior_pieces.png" id="2_3h4dj"]
|
||||
[ext_resource type="BehaviorTree" uid="uid://b1mfh8yad7rmw" path="res://demo/ai/trees/tutorial/tutorial_01_welcome.tres" id="3_ilmgw"]
|
||||
|
||||
[sub_resource type="BlackboardPlan" id="BlackboardPlan_52mdk"]
|
||||
|
||||
[node name="TutorialWelcome" instance=ExtResource("1_2vrmp")]
|
||||
|
||||
[node name="LegL" parent="Root/Rig" index="1"]
|
||||
texture = ExtResource("2_3h4dj")
|
||||
|
||||
[node name="LegR" parent="Root/Rig" index="2"]
|
||||
texture = ExtResource("2_3h4dj")
|
||||
|
||||
[node name="Body" parent="Root/Rig" index="3"]
|
||||
texture = ExtResource("2_3h4dj")
|
||||
|
||||
[node name="Hat" parent="Root/Rig/Body" index="0"]
|
||||
texture = ExtResource("2_3h4dj")
|
||||
|
||||
[node name="HandL" parent="Root/Rig/Body" index="1"]
|
||||
texture = ExtResource("2_3h4dj")
|
||||
|
||||
[node name="HandR" parent="Root/Rig/Body" index="2"]
|
||||
texture = ExtResource("2_3h4dj")
|
||||
|
||||
[node name="BTPlayer" type="BTPlayer" parent="." index="5"]
|
||||
behavior_tree = ExtResource("3_ilmgw")
|
||||
blackboard_plan = SubResource("BlackboardPlan_52mdk")
|
||||
31
demo/agents/tutorial/tutorial_02_introduction.tscn
Normal file
31
demo/agents/tutorial/tutorial_02_introduction.tscn
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
[gd_scene load_steps=5 format=3 uid="uid://cw3yth564nhrw"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://ooigbfhfy4wa" path="res://demo/agents/agent_base.tscn" id="1_lia2k"]
|
||||
[ext_resource type="Texture2D" uid="uid://b0oeqsc0xksto" path="res://demo/assets/agent_junior_pieces.png" id="2_4x2l4"]
|
||||
[ext_resource type="BehaviorTree" uid="uid://b1i0xo0o676va" path="res://demo/ai/trees/tutorial/tutorial_02_introduction.tres" id="3_3esuy"]
|
||||
|
||||
[sub_resource type="BlackboardPlan" id="BlackboardPlan_52mdk"]
|
||||
|
||||
[node name="TutorialIntro" instance=ExtResource("1_lia2k")]
|
||||
|
||||
[node name="LegL" parent="Root/Rig" index="1"]
|
||||
texture = ExtResource("2_4x2l4")
|
||||
|
||||
[node name="LegR" parent="Root/Rig" index="2"]
|
||||
texture = ExtResource("2_4x2l4")
|
||||
|
||||
[node name="Body" parent="Root/Rig" index="3"]
|
||||
texture = ExtResource("2_4x2l4")
|
||||
|
||||
[node name="Hat" parent="Root/Rig/Body" index="0"]
|
||||
texture = ExtResource("2_4x2l4")
|
||||
|
||||
[node name="HandL" parent="Root/Rig/Body" index="1"]
|
||||
texture = ExtResource("2_4x2l4")
|
||||
|
||||
[node name="HandR" parent="Root/Rig/Body" index="2"]
|
||||
texture = ExtResource("2_4x2l4")
|
||||
|
||||
[node name="BTPlayer" type="BTPlayer" parent="." index="5"]
|
||||
behavior_tree = ExtResource("3_3esuy")
|
||||
blackboard_plan = SubResource("BlackboardPlan_52mdk")
|
||||
31
demo/agents/tutorial/tutorial_03_types.tscn
Normal file
31
demo/agents/tutorial/tutorial_03_types.tscn
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
[gd_scene load_steps=5 format=3 uid="uid://bx4iabilsv3rs"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://ooigbfhfy4wa" path="res://demo/agents/agent_base.tscn" id="1_p8nwq"]
|
||||
[ext_resource type="Texture2D" uid="uid://b0oeqsc0xksto" path="res://demo/assets/agent_junior_pieces.png" id="2_hnwhw"]
|
||||
[ext_resource type="BehaviorTree" uid="uid://cb0ybf24ahnc3" path="res://demo/ai/trees/tutorial/tutorial_03_types.tres" id="3_a31ka"]
|
||||
|
||||
[sub_resource type="BlackboardPlan" id="BlackboardPlan_52mdk"]
|
||||
|
||||
[node name="TutorialTypes" instance=ExtResource("1_p8nwq")]
|
||||
|
||||
[node name="LegL" parent="Root/Rig" index="1"]
|
||||
texture = ExtResource("2_hnwhw")
|
||||
|
||||
[node name="LegR" parent="Root/Rig" index="2"]
|
||||
texture = ExtResource("2_hnwhw")
|
||||
|
||||
[node name="Body" parent="Root/Rig" index="3"]
|
||||
texture = ExtResource("2_hnwhw")
|
||||
|
||||
[node name="Hat" parent="Root/Rig/Body" index="0"]
|
||||
texture = ExtResource("2_hnwhw")
|
||||
|
||||
[node name="HandL" parent="Root/Rig/Body" index="1"]
|
||||
texture = ExtResource("2_hnwhw")
|
||||
|
||||
[node name="HandR" parent="Root/Rig/Body" index="2"]
|
||||
texture = ExtResource("2_hnwhw")
|
||||
|
||||
[node name="BTPlayer" type="BTPlayer" parent="." index="5"]
|
||||
behavior_tree = ExtResource("3_a31ka")
|
||||
blackboard_plan = SubResource("BlackboardPlan_52mdk")
|
||||
31
demo/agents/tutorial/tutorial_04_sequence.tscn
Normal file
31
demo/agents/tutorial/tutorial_04_sequence.tscn
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
[gd_scene load_steps=5 format=3 uid="uid://bhtm8gnk5hsus"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://ooigbfhfy4wa" path="res://demo/agents/agent_base.tscn" id="1_oibr1"]
|
||||
[ext_resource type="Texture2D" uid="uid://b0oeqsc0xksto" path="res://demo/assets/agent_junior_pieces.png" id="2_j52yc"]
|
||||
[ext_resource type="BehaviorTree" uid="uid://dln8ywvtqedt7" path="res://demo/ai/trees/tutorial/tutorial_04_sequence.tres" id="3_feewj"]
|
||||
|
||||
[sub_resource type="BlackboardPlan" id="BlackboardPlan_52mdk"]
|
||||
|
||||
[node name="TutorialSequence" instance=ExtResource("1_oibr1")]
|
||||
|
||||
[node name="LegL" parent="Root/Rig" index="1"]
|
||||
texture = ExtResource("2_j52yc")
|
||||
|
||||
[node name="LegR" parent="Root/Rig" index="2"]
|
||||
texture = ExtResource("2_j52yc")
|
||||
|
||||
[node name="Body" parent="Root/Rig" index="3"]
|
||||
texture = ExtResource("2_j52yc")
|
||||
|
||||
[node name="Hat" parent="Root/Rig/Body" index="0"]
|
||||
texture = ExtResource("2_j52yc")
|
||||
|
||||
[node name="HandL" parent="Root/Rig/Body" index="1"]
|
||||
texture = ExtResource("2_j52yc")
|
||||
|
||||
[node name="HandR" parent="Root/Rig/Body" index="2"]
|
||||
texture = ExtResource("2_j52yc")
|
||||
|
||||
[node name="BTPlayer" type="BTPlayer" parent="." index="5"]
|
||||
behavior_tree = ExtResource("3_feewj")
|
||||
blackboard_plan = SubResource("BlackboardPlan_52mdk")
|
||||
31
demo/agents/tutorial/tutorial_05_selector.tscn
Normal file
31
demo/agents/tutorial/tutorial_05_selector.tscn
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
[gd_scene load_steps=5 format=3 uid="uid://5nqbasyipupf"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://ooigbfhfy4wa" path="res://demo/agents/agent_base.tscn" id="1_62fs7"]
|
||||
[ext_resource type="Texture2D" uid="uid://b0oeqsc0xksto" path="res://demo/assets/agent_junior_pieces.png" id="2_gdg2c"]
|
||||
[ext_resource type="BehaviorTree" uid="uid://bf4r652fv5kwi" path="res://demo/ai/trees/tutorial/tutorial_05_selector.tres" id="3_pm5ep"]
|
||||
|
||||
[sub_resource type="BlackboardPlan" id="BlackboardPlan_52mdk"]
|
||||
|
||||
[node name="TutorialSelector" instance=ExtResource("1_62fs7")]
|
||||
|
||||
[node name="LegL" parent="Root/Rig" index="1"]
|
||||
texture = ExtResource("2_gdg2c")
|
||||
|
||||
[node name="LegR" parent="Root/Rig" index="2"]
|
||||
texture = ExtResource("2_gdg2c")
|
||||
|
||||
[node name="Body" parent="Root/Rig" index="3"]
|
||||
texture = ExtResource("2_gdg2c")
|
||||
|
||||
[node name="Hat" parent="Root/Rig/Body" index="0"]
|
||||
texture = ExtResource("2_gdg2c")
|
||||
|
||||
[node name="HandL" parent="Root/Rig/Body" index="1"]
|
||||
texture = ExtResource("2_gdg2c")
|
||||
|
||||
[node name="HandR" parent="Root/Rig/Body" index="2"]
|
||||
texture = ExtResource("2_gdg2c")
|
||||
|
||||
[node name="BTPlayer" type="BTPlayer" parent="." index="5"]
|
||||
behavior_tree = ExtResource("3_pm5ep")
|
||||
blackboard_plan = SubResource("BlackboardPlan_52mdk")
|
||||
31
demo/agents/tutorial/tutorial_06_decorators.tscn
Normal file
31
demo/agents/tutorial/tutorial_06_decorators.tscn
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
[gd_scene load_steps=5 format=3 uid="uid://ehc00upu3co"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://ooigbfhfy4wa" path="res://demo/agents/agent_base.tscn" id="1_mbrnd"]
|
||||
[ext_resource type="Texture2D" uid="uid://b0oeqsc0xksto" path="res://demo/assets/agent_junior_pieces.png" id="2_ttkri"]
|
||||
[ext_resource type="BehaviorTree" uid="uid://beiki511huxb8" path="res://demo/ai/trees/tutorial/tutorial_06_decorators.tres" id="3_tpgll"]
|
||||
|
||||
[sub_resource type="BlackboardPlan" id="BlackboardPlan_52mdk"]
|
||||
|
||||
[node name="TutorialDecorators" instance=ExtResource("1_mbrnd")]
|
||||
|
||||
[node name="LegL" parent="Root/Rig" index="1"]
|
||||
texture = ExtResource("2_ttkri")
|
||||
|
||||
[node name="LegR" parent="Root/Rig" index="2"]
|
||||
texture = ExtResource("2_ttkri")
|
||||
|
||||
[node name="Body" parent="Root/Rig" index="3"]
|
||||
texture = ExtResource("2_ttkri")
|
||||
|
||||
[node name="Hat" parent="Root/Rig/Body" index="0"]
|
||||
texture = ExtResource("2_ttkri")
|
||||
|
||||
[node name="HandL" parent="Root/Rig/Body" index="1"]
|
||||
texture = ExtResource("2_ttkri")
|
||||
|
||||
[node name="HandR" parent="Root/Rig/Body" index="2"]
|
||||
texture = ExtResource("2_ttkri")
|
||||
|
||||
[node name="BTPlayer" type="BTPlayer" parent="." index="5"]
|
||||
behavior_tree = ExtResource("3_tpgll")
|
||||
blackboard_plan = SubResource("BlackboardPlan_52mdk")
|
||||
31
demo/agents/tutorial/tutorial_07_more_decorators.tscn
Normal file
31
demo/agents/tutorial/tutorial_07_more_decorators.tscn
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
[gd_scene load_steps=5 format=3 uid="uid://brq6c843j1eeo"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://ooigbfhfy4wa" path="res://demo/agents/agent_base.tscn" id="1_k4qfc"]
|
||||
[ext_resource type="Texture2D" uid="uid://b0oeqsc0xksto" path="res://demo/assets/agent_junior_pieces.png" id="2_q4r1n"]
|
||||
[ext_resource type="BehaviorTree" uid="uid://tep50j4d6kgp" path="res://demo/ai/trees/tutorial/tutorial_07_more_decorators.tres" id="3_ta3g6"]
|
||||
|
||||
[sub_resource type="BlackboardPlan" id="BlackboardPlan_52mdk"]
|
||||
|
||||
[node name="TutorialMoreDecorators" instance=ExtResource("1_k4qfc")]
|
||||
|
||||
[node name="LegL" parent="Root/Rig" index="1"]
|
||||
texture = ExtResource("2_q4r1n")
|
||||
|
||||
[node name="LegR" parent="Root/Rig" index="2"]
|
||||
texture = ExtResource("2_q4r1n")
|
||||
|
||||
[node name="Body" parent="Root/Rig" index="3"]
|
||||
texture = ExtResource("2_q4r1n")
|
||||
|
||||
[node name="Hat" parent="Root/Rig/Body" index="0"]
|
||||
texture = ExtResource("2_q4r1n")
|
||||
|
||||
[node name="HandL" parent="Root/Rig/Body" index="1"]
|
||||
texture = ExtResource("2_q4r1n")
|
||||
|
||||
[node name="HandR" parent="Root/Rig/Body" index="2"]
|
||||
texture = ExtResource("2_q4r1n")
|
||||
|
||||
[node name="BTPlayer" type="BTPlayer" parent="." index="5"]
|
||||
behavior_tree = ExtResource("3_ta3g6")
|
||||
blackboard_plan = SubResource("BlackboardPlan_52mdk")
|
||||
31
demo/agents/tutorial/tutorial_08_final_touch.tscn
Normal file
31
demo/agents/tutorial/tutorial_08_final_touch.tscn
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
[gd_scene load_steps=5 format=3 uid="uid://b8yj40s43bw8h"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://ooigbfhfy4wa" path="res://demo/agents/agent_base.tscn" id="1_bjdsc"]
|
||||
[ext_resource type="Texture2D" uid="uid://b0oeqsc0xksto" path="res://demo/assets/agent_junior_pieces.png" id="2_onjfd"]
|
||||
[ext_resource type="BehaviorTree" uid="uid://dp0cglcytwcj5" path="res://demo/ai/trees/tutorial/tutorial_08_final_touch.tres" id="3_c5qx4"]
|
||||
|
||||
[sub_resource type="BlackboardPlan" id="BlackboardPlan_52mdk"]
|
||||
|
||||
[node name="TutorialFinalTouch" instance=ExtResource("1_bjdsc")]
|
||||
|
||||
[node name="LegL" parent="Root/Rig" index="1"]
|
||||
texture = ExtResource("2_onjfd")
|
||||
|
||||
[node name="LegR" parent="Root/Rig" index="2"]
|
||||
texture = ExtResource("2_onjfd")
|
||||
|
||||
[node name="Body" parent="Root/Rig" index="3"]
|
||||
texture = ExtResource("2_onjfd")
|
||||
|
||||
[node name="Hat" parent="Root/Rig/Body" index="0"]
|
||||
texture = ExtResource("2_onjfd")
|
||||
|
||||
[node name="HandL" parent="Root/Rig/Body" index="1"]
|
||||
texture = ExtResource("2_onjfd")
|
||||
|
||||
[node name="HandR" parent="Root/Rig/Body" index="2"]
|
||||
texture = ExtResource("2_onjfd")
|
||||
|
||||
[node name="BTPlayer" type="BTPlayer" parent="." index="5"]
|
||||
behavior_tree = ExtResource("3_c5qx4")
|
||||
blackboard_plan = SubResource("BlackboardPlan_52mdk")
|
||||
Loading…
Add table
Add a link
Reference in a new issue