diff --git a/art/Pink_Monster_Idle_4.png b/art/Pink_Monster_Idle_4.png new file mode 100644 index 0000000..6d49c46 Binary files /dev/null and b/art/Pink_Monster_Idle_4.png differ diff --git a/art/Pink_Monster_Idle_4.png.import b/art/Pink_Monster_Idle_4.png.import new file mode 100644 index 0000000..00f7c8f --- /dev/null +++ b/art/Pink_Monster_Idle_4.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dylr4xf3far68" +path="res://.godot/imported/Pink_Monster_Idle_4.png-dfd4ddf26ff0c47d32f43de16090eb28.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://art/Pink_Monster_Idle_4.png" +dest_files=["res://.godot/imported/Pink_Monster_Idle_4.png-dfd4ddf26ff0c47d32f43de16090eb28.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/art/Pink_Monster_Run_6.png b/art/Pink_Monster_Run_6.png new file mode 100644 index 0000000..bc2beda Binary files /dev/null and b/art/Pink_Monster_Run_6.png differ diff --git a/art/Pink_Monster_Run_6.png.import b/art/Pink_Monster_Run_6.png.import new file mode 100644 index 0000000..bfd15b3 --- /dev/null +++ b/art/Pink_Monster_Run_6.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bql3ivf3dql6f" +path="res://.godot/imported/Pink_Monster_Run_6.png-d337bc3c6832d6b33b34cde0ca44e357.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://art/Pink_Monster_Run_6.png" +dest_files=["res://.godot/imported/Pink_Monster_Run_6.png-d337bc3c6832d6b33b34cde0ca44e357.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/art/Pink_Monster_Throw_4.png b/art/Pink_Monster_Throw_4.png new file mode 100644 index 0000000..b830a81 Binary files /dev/null and b/art/Pink_Monster_Throw_4.png differ diff --git a/art/Pink_Monster_Throw_4.png.import b/art/Pink_Monster_Throw_4.png.import new file mode 100644 index 0000000..59195a5 --- /dev/null +++ b/art/Pink_Monster_Throw_4.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bydnrc6ixlv8w" +path="res://.godot/imported/Pink_Monster_Throw_4.png-6379c8d3070f7e87fe37b02ca39c1690.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://art/Pink_Monster_Throw_4.png" +dest_files=["res://.godot/imported/Pink_Monster_Throw_4.png-6379c8d3070f7e87fe37b02ca39c1690.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/scenes/enemy.tscn b/scenes/enemy.tscn index a51957b..f585a5d 100644 --- a/scenes/enemy.tscn +++ b/scenes/enemy.tscn @@ -1,7 +1,8 @@ -[gd_scene load_steps=7 format=3 uid="uid://bktg1ypaav3q3"] +[gd_scene load_steps=10 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="Texture2D" uid="uid://dylr4xf3far68" path="res://art/Pink_Monster_Idle_4.png" id="2_duxxr"] [ext_resource type="PackedScene" uid="uid://b51tdt5kunai" path="res://scenes/enemy_behavior_tree.tscn" id="3_jk76t"] [sub_resource type="Animation" id="Animation_etqki"] @@ -11,18 +12,100 @@ loop_mode = 1 tracks/0/type = "value" tracks/0/imported = false tracks/0/enabled = true -tracks/0/path = NodePath("Sprite2D:frame") +tracks/0/path = NodePath("Sprite2D:texture") tracks/0/interp = 1 tracks/0/loop_wrap = true tracks/0/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 1, +"values": [ExtResource("1_e5603")] +} +tracks/1/type = "value" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath("Sprite2D:hframes") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 1, +"values": [6] +} +tracks/2/type = "value" +tracks/2/imported = false +tracks/2/enabled = true +tracks/2/path = NodePath("Sprite2D:frame") +tracks/2/interp = 1 +tracks/2/loop_wrap = true +tracks/2/keys = { "times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4, 0.5), "transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1), "update": 1, "values": [0, 1, 2, 3, 4, 5] } +[sub_resource type="Animation" id="Animation_6vdwd"] +resource_name = "idle" +length = 0.4 +loop_mode = 1 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("Sprite2D:texture") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 1, +"values": [ExtResource("2_duxxr")] +} +tracks/1/type = "value" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath("Sprite2D:hframes") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 1, +"values": [4] +} +tracks/2/type = "value" +tracks/2/imported = false +tracks/2/enabled = true +tracks/2/path = NodePath("Sprite2D:frame") +tracks/2/interp = 1 +tracks/2/loop_wrap = true +tracks/2/keys = { +"times": PackedFloat32Array(0, 0.1, 0.2, 0.3), +"transitions": PackedFloat32Array(1, 1, 1, 1), +"update": 1, +"values": [0, 1, 2, 3] +} + +[sub_resource type="Animation" id="Animation_ouyrp"] +length = 0.001 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("Sprite2D: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="AnimationLibrary" id="AnimationLibrary_gnukq"] _data = { +"RESET": SubResource("Animation_ouyrp"), +"idle": SubResource("Animation_6vdwd"), "walk": SubResource("Animation_etqki") } @@ -34,9 +117,9 @@ script = ExtResource("1_l5lyv") [node name="Sprite2D" type="Sprite2D" parent="."] position = Vector2(0, -16) -texture = ExtResource("1_e5603") +texture = ExtResource("2_duxxr") flip_h = true -hframes = 6 +hframes = 4 [node name="AnimationPlayer" type="AnimationPlayer" parent="."] libraries = { diff --git a/scenes/enemy_behavior_tree.tscn b/scenes/enemy_behavior_tree.tscn index b2a3552..9befc4e 100644 --- a/scenes/enemy_behavior_tree.tscn +++ b/scenes/enemy_behavior_tree.tscn @@ -1,22 +1,42 @@ -[gd_scene load_steps=6 format=3 uid="uid://b51tdt5kunai"] +[gd_scene load_steps=10 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://addons/beehave/nodes/composites/selector.gd" id="2_xkd41"] [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"] +[ext_resource type="Script" path="res://scripts/can_wait_condition.gd" id="4_x5ium"] +[ext_resource type="Script" path="res://addons/beehave/nodes/decorators/time_limiter.gd" id="5_012bh"] +[ext_resource type="Script" path="res://scripts/wait_action.gd" id="5_xel2n"] +[ext_resource type="Script" path="res://scripts/get_random_top_cell_action.gd" id="7_uo3i6"] [node name="EnemyBehaviorTree" type="Node"] script = ExtResource("1_b2pc4") -[node name="ReturnBallSequence" type="Node" parent="."] +[node name="MainSelector" type="Node" parent="."] +script = ExtResource("2_xkd41") + +[node name="WaitSequence" type="Node" parent="MainSelector"] script = ExtResource("2_80fm4") -[node name="IsIdle" type="Node" parent="ReturnBallSequence"] +[node name="CanWait" type="Node" parent="MainSelector/WaitSequence"] +script = ExtResource("4_x5ium") + +[node name="TimeLimiterDecorator" type="Node" parent="MainSelector/WaitSequence"] +script = ExtResource("5_012bh") +wait_time = 2.0 + +[node name="Wait" type="Node" parent="MainSelector/WaitSequence/TimeLimiterDecorator"] +script = ExtResource("5_xel2n") + +[node name="ReturnBallSequence" type="Node" parent="MainSelector"] +script = ExtResource("2_80fm4") + +[node name="IsIdle" type="Node" parent="MainSelector/ReturnBallSequence"] script = ExtResource("3_5jur1") -[node name="GetRandomTopCell" type="Node" parent="ReturnBallSequence"] -script = ExtResource("4_ouqf7") +[node name="GetRandomTopCell" type="Node" parent="MainSelector/ReturnBallSequence"] +script = ExtResource("7_uo3i6") -[node name="MoveToTargetAction" type="Node" parent="ReturnBallSequence"] +[node name="MoveToTarget" type="Node" parent="MainSelector/ReturnBallSequence"] script = ExtResource("4_1on4v") diff --git a/scripts/can_wait_condition.gd b/scripts/can_wait_condition.gd new file mode 100644 index 0000000..565cdc7 --- /dev/null +++ b/scripts/can_wait_condition.gd @@ -0,0 +1,8 @@ +class_name CanWaitCodition +extends ConditionLeaf + +func tick(_actor, _blackboard): + var num = randi_range(0, 1) + if num == 0: + return SUCCESS + return FAILURE diff --git a/scripts/get_random_top_cell.gd b/scripts/get_random_top_cell_action.gd similarity index 90% rename from scripts/get_random_top_cell.gd rename to scripts/get_random_top_cell_action.gd index 9c1e3b9..ddd9cf2 100644 --- a/scripts/get_random_top_cell.gd +++ b/scripts/get_random_top_cell_action.gd @@ -1,4 +1,4 @@ -class_name GetRandomTopCell +class_name GetRandomTopCellAction extends ActionLeaf func tick(actor, _blackboard): diff --git a/scripts/is_idle_condition.gd b/scripts/is_idle_condition.gd index aebe796..ea20247 100644 --- a/scripts/is_idle_condition.gd +++ b/scripts/is_idle_condition.gd @@ -1,5 +1,5 @@ class_name IsIdleCondition extends ConditionLeaf -func tick(actor, _blackboard): +func tick(_actor, _blackboard): return SUCCESS diff --git a/scripts/move_to_target_action.gd b/scripts/move_to_target_action.gd index 82dd4e5..d01e679 100644 --- a/scripts/move_to_target_action.gd +++ b/scripts/move_to_target_action.gd @@ -1,7 +1,7 @@ class_name MoveToTargetAction extends ActionLeaf -func before_run(actor, blackboard): +func before_run(actor, _blackboard): actor.animation_player.play("walk") func tick(actor, _blackboard): @@ -12,5 +12,5 @@ func tick(actor, _blackboard): return SUCCESS return RUNNING -func after_run(actor, blackboard): +func after_run(actor, _blackboard): actor.animation_player.stop() diff --git a/scripts/wait_action.gd b/scripts/wait_action.gd new file mode 100644 index 0000000..3e90044 --- /dev/null +++ b/scripts/wait_action.gd @@ -0,0 +1,8 @@ +class_name WaitAction +extends ActionLeaf + +func before_run(actor, _blackboard): + actor.animation_player.play("idle") + +func tick(actor, blackboard): + return RUNNING