Compare commits
5 Commits
5c764aa526
...
beta-1.6/p
| Author | SHA1 | Date | |
|---|---|---|---|
| 7ad56fb876 | |||
| eabfeab91a | |||
| 7cd34cb07e | |||
| 5fb4a96159 | |||
| bfe4f7d6a9 |
3
.gitignore
vendored
3
.gitignore
vendored
@@ -17,3 +17,6 @@ mono_crash.*.json
|
||||
|
||||
# Android build files
|
||||
/android/
|
||||
|
||||
# Rider files
|
||||
.idea
|
||||
BIN
Assets/Aseprite Files/Game Icon.aseprite
Normal file
BIN
Assets/Aseprite Files/Game Icon.aseprite
Normal file
Binary file not shown.
BIN
Assets/Spritesheets/Icons/UI/64x64.png
Normal file
BIN
Assets/Spritesheets/Icons/UI/64x64.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 MiB |
40
Assets/Spritesheets/Icons/UI/64x64.png.import
Normal file
40
Assets/Spritesheets/Icons/UI/64x64.png.import
Normal file
@@ -0,0 +1,40 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bo1utikr0r2q1"
|
||||
path="res://.godot/imported/64x64.png-129f36e07b18bd0408477af73ef87a83.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Assets/Spritesheets/Icons/UI/64x64.png"
|
||||
dest_files=["res://.godot/imported/64x64.png-129f36e07b18bd0408477af73ef87a83.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
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/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
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
|
||||
28
Debug/Unit Testing/Scripts/base_test_runner.gd
Normal file
28
Debug/Unit Testing/Scripts/base_test_runner.gd
Normal file
@@ -0,0 +1,28 @@
|
||||
extends Node
|
||||
class_name BaseTestRunner
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
var methods := self.get_method_list()
|
||||
for method in methods:
|
||||
var method_name: String = method["name"]
|
||||
if method_name.left(5).to_lower() != "test_":
|
||||
continue
|
||||
|
||||
var return_dict: Dictionary = method["return"]
|
||||
var return_type: int = return_dict["type"]
|
||||
|
||||
if return_type != 1:
|
||||
print_rich("[color=yellow]Skipping Unit Test Method '%s'. Reason: Return type is not bool[/color]" % method_name)
|
||||
continue
|
||||
|
||||
var args: Array = method["args"]
|
||||
if not args.is_empty():
|
||||
print_rich("[color=yellow]Skipping Unit Test Method '%s', Reason: Method requires arguments.[/color]" % method_name)
|
||||
continue
|
||||
|
||||
var result: bool = call(method_name)
|
||||
if result:
|
||||
print_rich("[color=green]%s: Success![/color]" % method_name)
|
||||
else:
|
||||
print_rich("[color=red]%s: Failure...[/color]" % method_name)
|
||||
1
Debug/Unit Testing/Scripts/base_test_runner.gd.uid
Normal file
1
Debug/Unit Testing/Scripts/base_test_runner.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://bsewsmjxlup47
|
||||
3
Debug/Unit Testing/Scripts/base_test_runner.tscn
Normal file
3
Debug/Unit Testing/Scripts/base_test_runner.tscn
Normal file
@@ -0,0 +1,3 @@
|
||||
[gd_scene format=3 uid="uid://rl2o7alqg7w4"]
|
||||
|
||||
[node name="BaseTestRunner" type="Node" unique_id=1916529975]
|
||||
14
Debug/Unit Testing/Scripts/json_parsing_tests.gd
Normal file
14
Debug/Unit Testing/Scripts/json_parsing_tests.gd
Normal file
@@ -0,0 +1,14 @@
|
||||
extends BaseTestRunner
|
||||
|
||||
|
||||
func Test_1() -> bool:
|
||||
var json_string = "{\"Key\": false}"
|
||||
var json = JSON.new()
|
||||
var parse_result := json.parse(json_string)
|
||||
if parse_result != OK:
|
||||
return false
|
||||
return true
|
||||
|
||||
|
||||
func Test_2() -> String:
|
||||
return ''
|
||||
1
Debug/Unit Testing/Scripts/json_parsing_tests.gd.uid
Normal file
1
Debug/Unit Testing/Scripts/json_parsing_tests.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://xrexdmk7d1qx
|
||||
6
Debug/Unit Testing/json_parsing_tests.tscn
Normal file
6
Debug/Unit Testing/json_parsing_tests.tscn
Normal file
@@ -0,0 +1,6 @@
|
||||
[gd_scene format=3 uid="uid://c23ct3b1nmih7"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://xrexdmk7d1qx" path="res://Debug/Unit Testing/Scripts/json_parsing_tests.gd" id="1_beu12"]
|
||||
|
||||
[node name="JsonParsingTests" type="Node" unique_id=2014332517]
|
||||
script = ExtResource("1_beu12")
|
||||
@@ -5,6 +5,10 @@ enum States {
|
||||
PECKING
|
||||
}
|
||||
|
||||
@export var minimum_pecking_schedule_gap := 8.0
|
||||
@export var maximum_pecking_schedule_gap := 25.0
|
||||
@export var should_log_pecking_schedule := false
|
||||
|
||||
@onready var animated_sprite_2d: AnimatedSprite2D = $AnimatedSprite2D
|
||||
|
||||
var current_state := States.IDLE
|
||||
@@ -23,11 +27,12 @@ func _process(delta: float) -> void:
|
||||
animated_sprite_2d.play("pecking")
|
||||
await animated_sprite_2d.animation_finished
|
||||
animated_sprite_2d.play("idle")
|
||||
pecking_sched = randf_range(8.0, 25.0)
|
||||
pecking_sched = randf_range(minimum_pecking_schedule_gap, maximum_pecking_schedule_gap)
|
||||
pecking_timer = 0
|
||||
current_state = States.IDLE
|
||||
_print_sched()
|
||||
|
||||
|
||||
func _print_sched() -> void:
|
||||
print("%s Pecking Schedule: %f" % [name, pecking_sched])
|
||||
if should_log_pecking_schedule:
|
||||
print("%s Pecking Schedule: %f" % [name, pecking_sched])
|
||||
@@ -1,6 +1,6 @@
|
||||
[gd_scene format=3 uid="uid://clqfyxjtn67m"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://c5pt6iroi01si" path="res://Scripts/Characters/Chicken/npc_chicken.gd" id="1_etrql"]
|
||||
[ext_resource type="Script" uid="uid://c5pt6iroi01si" path="res://Entities/Characters/Animals/Chicken/Scripts/npc_chicken.gd" id="1_etrql"]
|
||||
[ext_resource type="Texture2D" uid="uid://d4lf74neoqf4p" path="res://Assets/Spritesheets/Animals/Chickens/Chicken_01.png" id="1_hjr72"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_etrql"]
|
||||
@@ -0,0 +1,7 @@
|
||||
[gd_scene format=3 uid="uid://6athlweutl2g"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://dacvayqstkvws" path="res://Entities/Characters/Player/Scripts/player_body.gd" id="1_qqvsf"]
|
||||
|
||||
[node name="Player Body" type="CharacterBody2D" unique_id=1502234578 groups=["Player Group"]]
|
||||
y_sort_enabled = true
|
||||
script = ExtResource("1_qqvsf")
|
||||
491
Entities/Characters/Player/Individual Components/sprite.tscn
Normal file
491
Entities/Characters/Player/Individual Components/sprite.tscn
Normal file
@@ -0,0 +1,491 @@
|
||||
[gd_scene format=3 uid="uid://uyl0s1e67x6s"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://cuar23q48cbja" path="res://Entities/Characters/Player/Scripts/sprite.gd" id="1_jqxwg"]
|
||||
[ext_resource type="Texture2D" uid="uid://d1mourl3rq437" path="res://Assets/Spritesheets/Player/player-full-01.png" id="2_ndjja"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_kg8vi"]
|
||||
atlas = ExtResource("2_ndjja")
|
||||
region = Rect2(0, 1472, 64, 64)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_eqnrc"]
|
||||
atlas = ExtResource("2_ndjja")
|
||||
region = Rect2(64, 1472, 64, 64)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_rr1pu"]
|
||||
atlas = ExtResource("2_ndjja")
|
||||
region = Rect2(128, 1472, 64, 64)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_85fw5"]
|
||||
atlas = ExtResource("2_ndjja")
|
||||
region = Rect2(0, 1536, 64, 64)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_5dpey"]
|
||||
atlas = ExtResource("2_ndjja")
|
||||
region = Rect2(64, 1536, 64, 64)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_vk7kj"]
|
||||
atlas = ExtResource("2_ndjja")
|
||||
region = Rect2(128, 1536, 64, 64)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_3ej6w"]
|
||||
atlas = ExtResource("2_ndjja")
|
||||
region = Rect2(0, 1600, 64, 64)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_j7iyf"]
|
||||
atlas = ExtResource("2_ndjja")
|
||||
region = Rect2(64, 1600, 64, 64)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_gw75a"]
|
||||
atlas = ExtResource("2_ndjja")
|
||||
region = Rect2(128, 1600, 64, 64)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_w2nd7"]
|
||||
atlas = ExtResource("2_ndjja")
|
||||
region = Rect2(192, 1472, 64, 64)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_rd4wh"]
|
||||
atlas = ExtResource("2_ndjja")
|
||||
region = Rect2(256, 1472, 64, 64)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_rwmr7"]
|
||||
atlas = ExtResource("2_ndjja")
|
||||
region = Rect2(320, 1472, 64, 64)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_na211"]
|
||||
atlas = ExtResource("2_ndjja")
|
||||
region = Rect2(192, 1536, 64, 64)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_kl0pt"]
|
||||
atlas = ExtResource("2_ndjja")
|
||||
region = Rect2(256, 1536, 64, 64)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_sdskq"]
|
||||
atlas = ExtResource("2_ndjja")
|
||||
region = Rect2(320, 1536, 64, 64)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_1dk7p"]
|
||||
atlas = ExtResource("2_ndjja")
|
||||
region = Rect2(192, 1600, 64, 64)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_5pvpc"]
|
||||
atlas = ExtResource("2_ndjja")
|
||||
region = Rect2(256, 1600, 64, 64)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_3uof2"]
|
||||
atlas = ExtResource("2_ndjja")
|
||||
region = Rect2(320, 1600, 64, 64)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_0s5vo"]
|
||||
atlas = ExtResource("2_ndjja")
|
||||
region = Rect2(0, 0, 64, 64)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_iy4ef"]
|
||||
atlas = ExtResource("2_ndjja")
|
||||
region = Rect2(64, 0, 64, 64)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_1l5y2"]
|
||||
atlas = ExtResource("2_ndjja")
|
||||
region = Rect2(128, 0, 64, 64)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_tbera"]
|
||||
atlas = ExtResource("2_ndjja")
|
||||
region = Rect2(192, 0, 64, 64)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_6giml"]
|
||||
atlas = ExtResource("2_ndjja")
|
||||
region = Rect2(256, 0, 64, 64)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_huf5g"]
|
||||
atlas = ExtResource("2_ndjja")
|
||||
region = Rect2(320, 0, 64, 64)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_bsgi0"]
|
||||
atlas = ExtResource("2_ndjja")
|
||||
region = Rect2(0, 64, 64, 64)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_72dk0"]
|
||||
atlas = ExtResource("2_ndjja")
|
||||
region = Rect2(64, 64, 64, 64)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_gwc2p"]
|
||||
atlas = ExtResource("2_ndjja")
|
||||
region = Rect2(128, 64, 64, 64)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_g4n6s"]
|
||||
atlas = ExtResource("2_ndjja")
|
||||
region = Rect2(192, 64, 64, 64)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_tvm7c"]
|
||||
atlas = ExtResource("2_ndjja")
|
||||
region = Rect2(256, 64, 64, 64)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_amsyc"]
|
||||
atlas = ExtResource("2_ndjja")
|
||||
region = Rect2(320, 64, 64, 64)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_ei8qf"]
|
||||
atlas = ExtResource("2_ndjja")
|
||||
region = Rect2(0, 128, 64, 64)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_3fwgt"]
|
||||
atlas = ExtResource("2_ndjja")
|
||||
region = Rect2(64, 128, 64, 64)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_83xkn"]
|
||||
atlas = ExtResource("2_ndjja")
|
||||
region = Rect2(128, 128, 64, 64)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_df3jv"]
|
||||
atlas = ExtResource("2_ndjja")
|
||||
region = Rect2(192, 128, 64, 64)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_bwglw"]
|
||||
atlas = ExtResource("2_ndjja")
|
||||
region = Rect2(256, 128, 64, 64)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_j74gm"]
|
||||
atlas = ExtResource("2_ndjja")
|
||||
region = Rect2(320, 128, 64, 64)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_e1olu"]
|
||||
atlas = ExtResource("2_ndjja")
|
||||
region = Rect2(0, 1280, 64, 64)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_jmdrl"]
|
||||
atlas = ExtResource("2_ndjja")
|
||||
region = Rect2(64, 1280, 64, 64)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_wk3mk"]
|
||||
atlas = ExtResource("2_ndjja")
|
||||
region = Rect2(128, 1280, 64, 64)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_8mpdo"]
|
||||
atlas = ExtResource("2_ndjja")
|
||||
region = Rect2(192, 1280, 64, 64)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_46inv"]
|
||||
atlas = ExtResource("2_ndjja")
|
||||
region = Rect2(256, 1280, 64, 64)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_s6rq5"]
|
||||
atlas = ExtResource("2_ndjja")
|
||||
region = Rect2(0, 192, 64, 64)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_pu3ni"]
|
||||
atlas = ExtResource("2_ndjja")
|
||||
region = Rect2(64, 192, 64, 64)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_qdlmc"]
|
||||
atlas = ExtResource("2_ndjja")
|
||||
region = Rect2(128, 192, 64, 64)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_wfvue"]
|
||||
atlas = ExtResource("2_ndjja")
|
||||
region = Rect2(192, 192, 64, 64)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_pdvtf"]
|
||||
atlas = ExtResource("2_ndjja")
|
||||
region = Rect2(256, 192, 64, 64)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_k84dj"]
|
||||
atlas = ExtResource("2_ndjja")
|
||||
region = Rect2(320, 192, 64, 64)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_thygw"]
|
||||
atlas = ExtResource("2_ndjja")
|
||||
region = Rect2(0, 256, 64, 64)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_soxdi"]
|
||||
atlas = ExtResource("2_ndjja")
|
||||
region = Rect2(64, 256, 64, 64)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_bexkr"]
|
||||
atlas = ExtResource("2_ndjja")
|
||||
region = Rect2(128, 256, 64, 64)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_7vbqj"]
|
||||
atlas = ExtResource("2_ndjja")
|
||||
region = Rect2(192, 256, 64, 64)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_xlw27"]
|
||||
atlas = ExtResource("2_ndjja")
|
||||
region = Rect2(256, 256, 64, 64)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_1unn3"]
|
||||
atlas = ExtResource("2_ndjja")
|
||||
region = Rect2(320, 256, 64, 64)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_n4kyy"]
|
||||
atlas = ExtResource("2_ndjja")
|
||||
region = Rect2(0, 320, 64, 64)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_6pm4n"]
|
||||
atlas = ExtResource("2_ndjja")
|
||||
region = Rect2(64, 320, 64, 64)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_2mqt6"]
|
||||
atlas = ExtResource("2_ndjja")
|
||||
region = Rect2(128, 320, 64, 64)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_4bosx"]
|
||||
atlas = ExtResource("2_ndjja")
|
||||
region = Rect2(192, 320, 64, 64)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_xx24f"]
|
||||
atlas = ExtResource("2_ndjja")
|
||||
region = Rect2(256, 320, 64, 64)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_fftbb"]
|
||||
atlas = ExtResource("2_ndjja")
|
||||
region = Rect2(320, 320, 64, 64)
|
||||
|
||||
[sub_resource type="SpriteFrames" id="SpriteFrames_jqxwg"]
|
||||
animations = [{
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_kg8vi")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_eqnrc")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_rr1pu")
|
||||
}],
|
||||
"loop": false,
|
||||
"name": &"drawing-bow-down",
|
||||
"speed": 5.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_85fw5")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_5dpey")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_vk7kj")
|
||||
}],
|
||||
"loop": false,
|
||||
"name": &"drawing-bow-side",
|
||||
"speed": 5.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_3ej6w")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_j7iyf")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_gw75a")
|
||||
}],
|
||||
"loop": false,
|
||||
"name": &"drawing-bow-up",
|
||||
"speed": 5.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_w2nd7")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_rd4wh")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_rwmr7")
|
||||
}],
|
||||
"loop": false,
|
||||
"name": &"firing-arrow-down",
|
||||
"speed": 5.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_na211")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_kl0pt")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_sdskq")
|
||||
}],
|
||||
"loop": false,
|
||||
"name": &"firing-arrow-side",
|
||||
"speed": 5.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_1dk7p")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_5pvpc")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_3uof2")
|
||||
}],
|
||||
"loop": false,
|
||||
"name": &"firing-arrow-up",
|
||||
"speed": 5.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_0s5vo")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_iy4ef")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_1l5y2")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_tbera")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_6giml")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_huf5g")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"idle-down",
|
||||
"speed": 5.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_bsgi0")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_72dk0")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_gwc2p")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_g4n6s")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_tvm7c")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_amsyc")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"idle-side",
|
||||
"speed": 5.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_ei8qf")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_3fwgt")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_83xkn")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_df3jv")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_bwglw")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_j74gm")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"idle-up",
|
||||
"speed": 5.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_e1olu")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_jmdrl")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_wk3mk")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_8mpdo")
|
||||
}, {
|
||||
"duration": 8.0,
|
||||
"texture": SubResource("AtlasTexture_46inv")
|
||||
}],
|
||||
"loop": false,
|
||||
"name": &"opening-chest-down",
|
||||
"speed": 8.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_s6rq5")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_pu3ni")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_qdlmc")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_wfvue")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_pdvtf")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_k84dj")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"walking-down",
|
||||
"speed": 10.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_thygw")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_soxdi")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_bexkr")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_7vbqj")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_xlw27")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_1unn3")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"walking-side",
|
||||
"speed": 10.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_n4kyy")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_6pm4n")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_2mqt6")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_4bosx")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_xx24f")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_fftbb")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"walking-up",
|
||||
"speed": 10.0
|
||||
}]
|
||||
|
||||
[node name="Sprite" type="AnimatedSprite2D" unique_id=1296959783]
|
||||
sprite_frames = SubResource("SpriteFrames_jqxwg")
|
||||
animation = &"idle-down"
|
||||
autoplay = "idle-down"
|
||||
script = ExtResource("1_jqxwg")
|
||||
@@ -1,6 +1,6 @@
|
||||
[gd_scene format=3 uid="uid://c2ydbmmvnfca6"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://c74mhfemxuuco" path="res://Scripts/Characters/Player/state_machine.gd" id="1_clu2m"]
|
||||
[ext_resource type="Script" uid="uid://c74mhfemxuuco" path="res://Entities/Characters/Player/Scripts/state_machine.gd" id="1_clu2m"]
|
||||
|
||||
[node name="StateMachine" type="Node" unique_id=732559774]
|
||||
[node name="State Machine" type="Node" unique_id=732559774]
|
||||
script = ExtResource("1_clu2m")
|
||||
56
Entities/Characters/Player/Scripts/States/base_state.gd
Normal file
56
Entities/Characters/Player/Scripts/States/base_state.gd
Normal file
@@ -0,0 +1,56 @@
|
||||
class_name BaseState
|
||||
extends Node
|
||||
|
||||
@export var state_machine: PlayerStateMachine
|
||||
|
||||
var _subscribed_events: Array[String] = []
|
||||
var _subscribed_events_callables: Array[Callable] = []
|
||||
|
||||
func GetStateEnum() -> PlayerStateMachine.States:
|
||||
push_error("Unimplemented Method: BaseState.GetStateEnum")
|
||||
return PlayerStateMachine.States.IDLE
|
||||
|
||||
|
||||
func GetAnimationBaseName() -> String:
|
||||
var state: String = PlayerStateMachine.States.keys()[GetStateEnum()]
|
||||
return state.to_lower()
|
||||
|
||||
|
||||
func Enter(_extra_parameters: Dictionary) -> void:
|
||||
pass
|
||||
|
||||
|
||||
func Exit() -> void:
|
||||
pass
|
||||
|
||||
|
||||
func Update(_delta: float) -> void:
|
||||
pass
|
||||
|
||||
|
||||
func IsActive() -> bool:
|
||||
return state_machine.GetCurrentStateEnum() == GetStateEnum()
|
||||
|
||||
|
||||
func IsStateActionable() -> bool:
|
||||
return true
|
||||
|
||||
|
||||
func SubscribeToEvent(event_name: String, callback: Callable) -> void:
|
||||
if _subscribed_events.has(event_name):
|
||||
return
|
||||
_subscribed_events.append(event_name)
|
||||
_subscribed_events_callables.append(callback)
|
||||
|
||||
|
||||
# State Machine Visibility Only
|
||||
func _StateMachine_OnEventSent(event_name: String, parameters: Variant) -> void:
|
||||
var idx := _subscribed_events.find(event_name)
|
||||
if idx == -1:
|
||||
push_error("THIS SHOULD NEVER HAPPEN LOL")
|
||||
|
||||
var callable := _subscribed_events_callables[idx]
|
||||
if callable.get_argument_count() == 0:
|
||||
callable.call()
|
||||
else:
|
||||
callable.call(parameters)
|
||||
@@ -3,35 +3,36 @@ extends BaseState
|
||||
signal PlayerBeganDrawingBow
|
||||
|
||||
@export var strafing_speed := 35
|
||||
@export var movement_componenent: MovementComponent
|
||||
@export var body: CharacterBody2D
|
||||
|
||||
var used_item_action: String
|
||||
var animation_finished := false
|
||||
var _used_item_action: String
|
||||
var _animation_finished := false
|
||||
var _movement_componenent: MovementComponent
|
||||
|
||||
func GetStateEnum() -> PlayerStateMachine.States:
|
||||
return PlayerStateMachine.States.DRAWING_BOW
|
||||
|
||||
|
||||
func Enter(extra_parameters: Dictionary) -> void:
|
||||
animation_finished = false
|
||||
used_item_action = extra_parameters.action_name
|
||||
_animation_finished = false
|
||||
_used_item_action = extra_parameters.action_name
|
||||
_movement_componenent = ComponentUtils.GetMovementComponent(body)
|
||||
PlayerBeganDrawingBow.emit()
|
||||
|
||||
|
||||
func Update(_delta: float) -> void:
|
||||
if !animation_finished:
|
||||
if !_animation_finished:
|
||||
return
|
||||
|
||||
if !Input.is_action_pressed(used_item_action):
|
||||
if !Input.is_action_pressed(_used_item_action):
|
||||
state_machine.QueueStateChange(PlayerStateMachine.States.FIRING_ARROW)
|
||||
return
|
||||
|
||||
var movement_vector := movement_componenent.movement_vector
|
||||
var movement_vector := _movement_componenent.movement_vector
|
||||
if movement_vector != Vector2.ZERO:
|
||||
body.velocity = movement_vector * strafing_speed
|
||||
body.move_and_slide()
|
||||
|
||||
|
||||
func OnDrawingBowAnimationFinished() -> void:
|
||||
animation_finished = true
|
||||
_animation_finished = true
|
||||
14
Entities/Characters/Player/Scripts/States/idle_state.gd
Normal file
14
Entities/Characters/Player/Scripts/States/idle_state.gd
Normal file
@@ -0,0 +1,14 @@
|
||||
extends BaseState
|
||||
|
||||
# idle_state.gd
|
||||
|
||||
func _ready() -> void:
|
||||
SubscribeToEvent("MovementQueued", OnMovementQueued)
|
||||
|
||||
|
||||
func OnMovementQueued(dv: Vector2) -> void:
|
||||
state_machine.QueueStateChange(PlayerStateMachine.States.WALKING, {"dv": dv})
|
||||
|
||||
|
||||
func GetStateEnum() -> PlayerStateMachine.States:
|
||||
return PlayerStateMachine.States.IDLE
|
||||
40
Entities/Characters/Player/Scripts/States/walking_state.gd
Normal file
40
Entities/Characters/Player/Scripts/States/walking_state.gd
Normal file
@@ -0,0 +1,40 @@
|
||||
extends BaseState
|
||||
|
||||
# walking_state.gd
|
||||
|
||||
signal StartedWalking
|
||||
|
||||
@export var walking_speed := 100
|
||||
@export var body: CharacterBody2D
|
||||
|
||||
var _queued_dv: Vector2
|
||||
|
||||
func _ready() -> void:
|
||||
SubscribeToEvent("MovementQueued", OnMovementQueued)
|
||||
SubscribeToEvent("NoMovementQueued", OnNoMovementQueued)
|
||||
|
||||
|
||||
func Enter(_extra_parameters: Dictionary) -> void:
|
||||
_queued_dv = _extra_parameters["dv"]
|
||||
StartedWalking.emit()
|
||||
|
||||
|
||||
func Update(_delta: float) -> void:
|
||||
if _queued_dv == Vector2.ZERO:
|
||||
state_machine.QueueStateChange(PlayerStateMachine.States.IDLE)
|
||||
return
|
||||
|
||||
body.velocity = _queued_dv * walking_speed
|
||||
body.move_and_slide()
|
||||
|
||||
|
||||
func OnMovementQueued(dv: Vector2) -> void:
|
||||
_queued_dv = dv
|
||||
|
||||
|
||||
func OnNoMovementQueued() -> void:
|
||||
_queued_dv = Vector2.ZERO
|
||||
|
||||
|
||||
func GetStateEnum() -> PlayerStateMachine.States:
|
||||
return PlayerStateMachine.States.WALKING
|
||||
4
Entities/Characters/Player/Scripts/player_body.gd
Normal file
4
Entities/Characters/Player/Scripts/player_body.gd
Normal file
@@ -0,0 +1,4 @@
|
||||
extends CharacterBody2D
|
||||
|
||||
# PlayerBody.gd:
|
||||
# Represents the player's actual CharacterBody (collision)
|
||||
3
Entities/Characters/Player/Scripts/sprite.gd
Normal file
3
Entities/Characters/Player/Scripts/sprite.gd
Normal file
@@ -0,0 +1,3 @@
|
||||
extends AnimatedSprite2D
|
||||
|
||||
# sprite.gd
|
||||
@@ -0,0 +1,64 @@
|
||||
extends Node
|
||||
|
||||
# sprite_animation_changer.gd
|
||||
|
||||
# When the player actually changes state or direction, this component will decide
|
||||
# which sprite animation should play
|
||||
|
||||
@export var sprite: AnimatedSprite2D
|
||||
|
||||
var _cached_dv: Vector2
|
||||
var _cached_state: PlayerStateMachine.States
|
||||
|
||||
var _walking_animation_data = {
|
||||
Vector2.LEFT: ["walking-side", true],
|
||||
Vector2.RIGHT: ["walking-side", false],
|
||||
Vector2.UP: ["walking-up", false],
|
||||
Vector2.DOWN: ["walking-down", false]
|
||||
}
|
||||
|
||||
var _idle_animation_data = {
|
||||
Vector2.LEFT: ["idle-side", true],
|
||||
Vector2.RIGHT: ["idle-side", false],
|
||||
Vector2.UP: ["idle-up", false],
|
||||
Vector2.DOWN: ["idle-down", false]
|
||||
}
|
||||
|
||||
func OnStateChanged(to_state: PlayerStateMachine.States, _from_state: PlayerStateMachine.States) -> void:
|
||||
_cached_state = to_state
|
||||
if to_state == PlayerStateMachine.States.WALKING:
|
||||
_to_walking_state()
|
||||
return
|
||||
if to_state == PlayerStateMachine.States.IDLE:
|
||||
_to_idle_state()
|
||||
return
|
||||
|
||||
|
||||
func OnMovementQueued(dv: Vector2) -> void:
|
||||
_cached_dv = Vector2Utils.GetClosestDirectionVector(dv)
|
||||
|
||||
if _cached_state == PlayerStateMachine.States.WALKING:
|
||||
# Direction changed while walking, update animation, just run _to_walking_state again
|
||||
_to_walking_state()
|
||||
|
||||
|
||||
func _to_walking_state() -> void:
|
||||
if _walking_animation_data.has(_cached_dv):
|
||||
var animation_data = _walking_animation_data[_cached_dv]
|
||||
var animation_name = animation_data[0] as String
|
||||
var is_flipped = animation_data[1] as bool
|
||||
|
||||
sprite.animation = animation_name
|
||||
sprite.flip_h = is_flipped
|
||||
sprite.play()
|
||||
|
||||
|
||||
func _to_idle_state() -> void:
|
||||
if _idle_animation_data.has(_cached_dv):
|
||||
var animation_data = _idle_animation_data[_cached_dv]
|
||||
var animation_name = animation_data[0] as String
|
||||
var is_flipped = animation_data[1] as bool
|
||||
|
||||
sprite.animation = animation_name
|
||||
sprite.flip_h = is_flipped
|
||||
sprite.play()
|
||||
@@ -0,0 +1 @@
|
||||
uid://by3g7ne2b3lgi
|
||||
11
Entities/Characters/Player/Scripts/state_event_connector.gd
Normal file
11
Entities/Characters/Player/Scripts/state_event_connector.gd
Normal file
@@ -0,0 +1,11 @@
|
||||
extends Node
|
||||
|
||||
@export var state_machine: PlayerStateMachine
|
||||
|
||||
# Public Methods
|
||||
func OnMovementQueued(direction_vector: Vector2) -> void:
|
||||
state_machine.SendEventToCurrentStateIfValid("MovementQueued", direction_vector)
|
||||
|
||||
|
||||
func OnNoMovementQueued() -> void:
|
||||
state_machine.SendEventToCurrentStateIfValid("NoMovementQueued")
|
||||
@@ -1,7 +1,7 @@
|
||||
extends Node
|
||||
class_name PlayerStateMachine
|
||||
|
||||
signal StateChanged
|
||||
signal StateChanged(to_state: States, from_state: States)
|
||||
|
||||
enum States {
|
||||
UNSET, IDLE, WALKING, USING_ITEM_A, DRAWING_BOW, FIRING_ARROW,
|
||||
@@ -25,6 +25,11 @@ func QueueStateChange(to_state_enum: PlayerStateMachine.States, extra_parameters
|
||||
queued_parameters = extra_parameters
|
||||
|
||||
|
||||
func SendEventToCurrentStateIfValid(signal_name: String, parameters: Variant = null) -> void:
|
||||
if current_state._subscribed_events.has(signal_name):
|
||||
current_state._StateMachine_OnEventSent(signal_name, parameters)
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
var children := states_container.get_children()
|
||||
@@ -47,6 +52,9 @@ func _process(delta: float) -> void:
|
||||
|
||||
|
||||
func _swap_state() -> void:
|
||||
var from_state := current_state.GetStateEnum()
|
||||
var to_state := queued_state
|
||||
|
||||
if current_state:
|
||||
current_state.Exit()
|
||||
|
||||
@@ -55,4 +63,4 @@ func _swap_state() -> void:
|
||||
queued_state = PlayerStateMachine.States.UNSET
|
||||
queued_parameters = {}
|
||||
|
||||
StateChanged.emit()
|
||||
StateChanged.emit(to_state, from_state)
|
||||
@@ -0,0 +1,8 @@
|
||||
[gd_scene format=3 uid="uid://dl4bhu5o71rdv"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://uyl0s1e67x6s" path="res://Entities/Characters/Player/Individual Components/sprite.tscn" id="1_ydjex"]
|
||||
|
||||
[node name="Decorative Player Map Entity" type="Node2D" unique_id=2077444123]
|
||||
y_sort_enabled = true
|
||||
|
||||
[node name="Sprite" parent="." unique_id=1296959783 instance=ExtResource("1_ydjex")]
|
||||
57
Entities/Characters/Player/player_map_entity.tscn
Normal file
57
Entities/Characters/Player/player_map_entity.tscn
Normal file
@@ -0,0 +1,57 @@
|
||||
[gd_scene format=3 uid="uid://c65cfm3t0obwq"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://6athlweutl2g" path="res://Entities/Characters/Player/Individual Components/body.tscn" id="1_62n52"]
|
||||
[ext_resource type="PackedScene" uid="uid://uyl0s1e67x6s" path="res://Entities/Characters/Player/Individual Components/sprite.tscn" id="2_1uhri"]
|
||||
[ext_resource type="PackedScene" uid="uid://c2ydbmmvnfca6" path="res://Entities/Characters/Player/Individual Components/state_machine.tscn" id="3_1uhri"]
|
||||
[ext_resource type="Script" uid="uid://dkmc1t43gomdb" path="res://Entities/Characters/Player/Scripts/States/idle_state.gd" id="4_evnf3"]
|
||||
[ext_resource type="PackedScene" uid="uid://nbkisxm2oekn" path="res://Entities/Characters/Utility/Components/movement_component.tscn" id="5_h314u"]
|
||||
[ext_resource type="Script" uid="uid://bwmmah30t3m0u" path="res://Entities/Characters/Player/Scripts/States/walking_state.gd" id="5_rg3km"]
|
||||
[ext_resource type="Script" uid="uid://ctoxjn2rvtjs6" path="res://Entities/Characters/Player/Scripts/state_event_connector.gd" id="6_18fwg"]
|
||||
[ext_resource type="Script" uid="uid://by3g7ne2b3lgi" path="res://Entities/Characters/Player/Scripts/sprite_animation_changer.gd" id="8_bm64c"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_62n52"]
|
||||
size = Vector2(13, 9)
|
||||
|
||||
[node name="Player Map Entity" type="Node2D" unique_id=469362016]
|
||||
y_sort_enabled = true
|
||||
|
||||
[node name="Player Body" parent="." unique_id=1502234578 instance=ExtResource("1_62n52")]
|
||||
collision_layer = 17
|
||||
|
||||
[node name="Sprite" parent="Player Body" unique_id=1169131604 instance=ExtResource("2_1uhri")]
|
||||
position = Vector2(0, 7)
|
||||
offset = Vector2(0, -7)
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Player Body" unique_id=760188594]
|
||||
position = Vector2(-0.5, 4.5)
|
||||
shape = SubResource("RectangleShape2D_62n52")
|
||||
|
||||
[node name="State Machine" parent="." unique_id=732559774 node_paths=PackedStringArray("states_container", "current_state") instance=ExtResource("3_1uhri")]
|
||||
states_container = NodePath(".")
|
||||
current_state = NodePath("Idle")
|
||||
|
||||
[node name="Idle" type="Node" parent="State Machine" unique_id=1849660058 node_paths=PackedStringArray("state_machine")]
|
||||
script = ExtResource("4_evnf3")
|
||||
state_machine = NodePath("..")
|
||||
|
||||
[node name="Walking" type="Node" parent="State Machine" unique_id=485440867 node_paths=PackedStringArray("body", "state_machine")]
|
||||
script = ExtResource("5_rg3km")
|
||||
body = NodePath("../../Player Body")
|
||||
state_machine = NodePath("..")
|
||||
|
||||
[node name="Movement Component" parent="." unique_id=737644583 instance=ExtResource("5_h314u")]
|
||||
|
||||
[node name="Internal" type="Node" parent="." unique_id=95043416]
|
||||
|
||||
[node name="State Event Connector" type="Node" parent="Internal" unique_id=186266500 node_paths=PackedStringArray("state_machine")]
|
||||
script = ExtResource("6_18fwg")
|
||||
state_machine = NodePath("../../State Machine")
|
||||
|
||||
[node name="Sprite Animation Changer" type="Node" parent="Internal" unique_id=281485983 node_paths=PackedStringArray("sprite")]
|
||||
script = ExtResource("8_bm64c")
|
||||
sprite = NodePath("../../Player Body/Sprite")
|
||||
|
||||
[connection signal="StateChanged" from="State Machine" to="Internal/Sprite Animation Changer" method="OnStateChanged"]
|
||||
[connection signal="MovementQueued" from="Movement Component" to="Internal/State Event Connector" method="OnMovementQueued"]
|
||||
[connection signal="MovementQueued" from="Movement Component" to="Internal/Sprite Animation Changer" method="OnMovementQueued"]
|
||||
[connection signal="NoMovementQueued" from="Movement Component" to="Internal/State Event Connector" method="OnNoMovementQueued"]
|
||||
@@ -0,0 +1,21 @@
|
||||
extends Node
|
||||
class_name MovementComponent
|
||||
|
||||
# movement_component.gd
|
||||
# A simple script that checks for movement input and emits a signal with the
|
||||
# direction vector
|
||||
|
||||
signal MovementQueued(direction_vector: Vector2)
|
||||
signal NoMovementQueued
|
||||
|
||||
var direction_vector: Vector2
|
||||
|
||||
func _physics_process(_delta: float) -> void:
|
||||
var dv := Input.get_vector("ui_left", "ui_right", "ui_up", "ui_down")
|
||||
|
||||
if dv:
|
||||
direction_vector = dv
|
||||
MovementQueued.emit(dv)
|
||||
else:
|
||||
direction_vector = Vector2.ZERO
|
||||
NoMovementQueued.emit()
|
||||
@@ -0,0 +1,6 @@
|
||||
[gd_scene format=3 uid="uid://nbkisxm2oekn"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://dwclkwbig1uii" path="res://Entities/Characters/Utility/Components/Scripts/movement_component.gd" id="1_b2nib"]
|
||||
|
||||
[node name="Movement Component" type="Node" unique_id=737644583]
|
||||
script = ExtResource("1_b2nib")
|
||||
@@ -0,0 +1 @@
|
||||
uid://ba0nsd76er3xa
|
||||
@@ -1,6 +1,6 @@
|
||||
[gd_scene format=3 uid="uid://d24gcv3umq60k"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://d4g6s63d0bh4o" path="res://Scripts/Objects/Occlusion/occlusion_culler.gd" id="1_4550i"]
|
||||
[ext_resource type="Script" uid="uid://ba0nsd76er3xa" path="res://Entities/Characters/Utility/Occlusion/Scripts/occlusion_culler.gd" id="1_4550i"]
|
||||
|
||||
[node name="Occlusion Culler" type="Area2D" unique_id=1362480066]
|
||||
collision_layer = 0
|
||||
@@ -1,6 +1,6 @@
|
||||
[gd_scene format=3 uid="uid://cd3iyspcdg8m"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://0fsmtp1umvmp" path="res://Scripts/Objects/Chests/Bases/chest_base.gd" id="1_6u2sl"]
|
||||
[ext_resource type="Script" uid="uid://0fsmtp1umvmp" path="res://Entities/Map Objects/Chests/Scripts/Bases/chest_base.gd" id="1_6u2sl"]
|
||||
|
||||
[node name="Base Chest" type="StaticBody2D" unique_id=975880832 groups=["Treasure Chest Group"]]
|
||||
y_sort_enabled = true
|
||||
@@ -1,6 +1,6 @@
|
||||
[gd_scene format=3 uid="uid://cncm0c4dmosgs"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://dbuc0f87m24xf" path="res://Scripts/Objects/Chests/Bases/item_chest.gd" id="1_mkt0u"]
|
||||
[ext_resource type="Script" uid="uid://dbuc0f87m24xf" path="res://Entities/Map Objects/Chests/Scripts/Bases/item_chest.gd" id="1_mkt0u"]
|
||||
|
||||
[node name="Base Item Chest" type="StaticBody2D" unique_id=991903258]
|
||||
script = ExtResource("1_mkt0u")
|
||||
@@ -1,7 +1,7 @@
|
||||
[gd_scene format=3 uid="uid://byp273amg5ji8"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bvq13h8uyx572" path="res://Scripts/Objects/Chests/item_chest_01.gd" id="1_lp0kr"]
|
||||
[ext_resource type="PackedScene" uid="uid://d3rqn611axsfk" path="res://Scenes/Animated Sprites/chest01_sprite.tscn" id="2_iwcc8"]
|
||||
[ext_resource type="Script" uid="uid://bvq13h8uyx572" path="res://Entities/Map Objects/Chests/Scripts/item_chest_01.gd" id="1_lp0kr"]
|
||||
[ext_resource type="PackedScene" uid="uid://d3rqn611axsfk" path="res://Entities/Map Objects/Chests/Sprites/chest01_sprite.tscn" id="2_iwcc8"]
|
||||
[ext_resource type="Texture2D" uid="uid://crf23tc55dxu" path="res://Assets/Spritesheets/Treasure Chests/Chest_Anim.png" id="3_iwcc8"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_y3ooa"]
|
||||
@@ -1,7 +1,7 @@
|
||||
[gd_scene format=3 uid="uid://b7u4hlvuqiefn"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bvq13h8uyx572" path="res://Scripts/Objects/Chests/item_chest_01.gd" id="1_77oue"]
|
||||
[ext_resource type="PackedScene" uid="uid://d3rqn611axsfk" path="res://Scenes/Animated Sprites/chest01_sprite.tscn" id="2_jpeii"]
|
||||
[ext_resource type="Script" uid="uid://bvq13h8uyx572" path="res://Entities/Map Objects/Chests/Scripts/item_chest_01.gd" id="1_77oue"]
|
||||
[ext_resource type="PackedScene" uid="uid://d3rqn611axsfk" path="res://Entities/Map Objects/Chests/Sprites/chest01_sprite.tscn" id="2_jpeii"]
|
||||
[ext_resource type="Texture2D" uid="uid://dcbk854sc3uud" path="res://Assets/Spritesheets/Home Decor/Metal_Chest_Anim.png" id="3_jpeii"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_y3ooa"]
|
||||
@@ -1,6 +1,7 @@
|
||||
extends StaticBody2D
|
||||
class_name BaseChest
|
||||
|
||||
signal ChestOpened
|
||||
signal OpeningAnimationStarted
|
||||
|
||||
@export var is_open := false
|
||||
@@ -8,7 +9,12 @@ signal OpeningAnimationStarted
|
||||
# Public Methods
|
||||
func Open() -> void:
|
||||
is_open = true
|
||||
ChestOpened.emit()
|
||||
|
||||
|
||||
func OpenAlreadyOpened() -> void:
|
||||
pass
|
||||
|
||||
|
||||
func SetOpenedFromLoad() -> void:
|
||||
is_open = true
|
||||
@@ -27,6 +27,11 @@ func OpenAlreadyOpened() -> void:
|
||||
already_opened_message_dialogue_trigger.Trigger()
|
||||
|
||||
|
||||
func SetOpenedFromLoad() -> void:
|
||||
super.SetOpenedFromLoad()
|
||||
chest_01_sprite.play("opened")
|
||||
|
||||
|
||||
# Private Methods
|
||||
func _ready() -> void:
|
||||
if is_open:
|
||||
@@ -1,7 +1,7 @@
|
||||
[gd_scene format=3 uid="uid://23tpba4r6ucg"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://nocnsf1xr3ap" path="res://Assets/Spritesheets/Outdoor Decor/Benches.png" id="1_jlu4v"]
|
||||
[ext_resource type="Script" uid="uid://c6n652dy18xbm" path="res://Scripts/Objects/Decorative/Outdoor/wooden_bench.gd" id="1_nv27i"]
|
||||
[ext_resource type="Script" uid="uid://c6n652dy18xbm" path="res://Entities/Map Objects/Decorative/Outdoor/Scripts/wooden_bench.gd" id="1_nv27i"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_nv27i"]
|
||||
size = Vector2(30, 11)
|
||||
@@ -1,6 +1,6 @@
|
||||
[gd_scene format=3 uid="uid://b60nr4wfvijpf"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://cfsfx0sahh5t7" path="res://Scripts/Objects/Dialogue/dialogue_trigger.gd" id="1_dyjvr"]
|
||||
[ext_resource type="Script" uid="uid://cfsfx0sahh5t7" path="res://Entities/Map Objects/Dialogue/Scripts/dialogue_trigger.gd" id="1_dyjvr"]
|
||||
|
||||
[node name="Dialogue Trigger" type="Area2D" unique_id=189867444 groups=["Dialog Trigger Group"]]
|
||||
collision_layer = 2
|
||||
21
Entities/Map Objects/Entity Spawners/arrow_spawner.gd
Normal file
21
Entities/Map Objects/Entity Spawners/arrow_spawner.gd
Normal file
@@ -0,0 +1,21 @@
|
||||
extends Node
|
||||
#extends Node
|
||||
#
|
||||
## Exports
|
||||
#@export var arrow_parent: Node2D
|
||||
#
|
||||
## Preloads
|
||||
#const wooden_arrow_scene: PackedScene = preload("uid://b2wq5m01b68rx")
|
||||
#
|
||||
## Private Methods
|
||||
#func _ready() -> void:
|
||||
#firing_arrow_state.ArrowFired.connect(_on_arrow_fired)
|
||||
#
|
||||
#
|
||||
#func _on_arrow_fired(fire_position: Vector2, direction: Vector2) -> void:
|
||||
#var wooden_arrow := wooden_arrow_scene.instantiate() as BaseProjectile
|
||||
#wooden_arrow.SetProjectileStartAndDirection(fire_position, direction)
|
||||
#
|
||||
#if arrow_parent == null:
|
||||
#return
|
||||
#arrow_parent.add_child(wooden_arrow)
|
||||
@@ -1,5 +1,7 @@
|
||||
extends StaticBody2D
|
||||
|
||||
signal Opened
|
||||
|
||||
@onready var sprite: AnimatedSprite2D = $AnimatedSprite2D
|
||||
@onready var collision_shape_2d: CollisionShape2D = $CollisionShape2D
|
||||
|
||||
@@ -15,3 +17,5 @@ func OpenGate() -> void:
|
||||
|
||||
collision_shape_2d.set_deferred("disabled", true)
|
||||
sprite.play("open")
|
||||
|
||||
Opened.emit()
|
||||
@@ -1,7 +1,7 @@
|
||||
[gd_scene format=3 uid="uid://da4qqruhldc6b"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://1kmd0qww3368" path="res://Assets/Spritesheets/Outdoor Objects/Spike_Gate_anim.png" id="1_5ttkm"]
|
||||
[ext_resource type="Script" uid="uid://8erg53skow38" path="res://Scripts/Objects/Gates/Spike Gate/spike_gate.gd" id="1_kye8r"]
|
||||
[ext_resource type="Script" uid="uid://8erg53skow38" path="res://Entities/Map Objects/Gates/Spike Gate/Scripts/spike_gate.gd" id="1_kye8r"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_5ttkm"]
|
||||
size = Vector2(29, 4)
|
||||
@@ -395,6 +395,6 @@ shape = SubResource("RectangleShape2D_5ttkm")
|
||||
y_sort_enabled = true
|
||||
position = Vector2(0, 15)
|
||||
sprite_frames = SubResource("SpriteFrames_pki7h")
|
||||
animation = &"closed"
|
||||
animation = &"open"
|
||||
autoplay = "closed"
|
||||
offset = Vector2(0, -15)
|
||||
@@ -1,5 +1,5 @@
|
||||
extends Node
|
||||
class_name LoadingZoneTransporter
|
||||
class_name EntranceTransporter
|
||||
|
||||
signal MapTransitionQueued(map_id: Enums.MapIds, marker_name: String)
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
uid://bqedrioybnvi5
|
||||
@@ -0,0 +1,8 @@
|
||||
extends Area2D
|
||||
class_name InteractiveEntrance
|
||||
|
||||
@export var entrance_transporter: EntranceTransporter
|
||||
|
||||
# Public Methods
|
||||
func Activate() -> void:
|
||||
entrance_transporter.Activate()
|
||||
@@ -0,0 +1 @@
|
||||
uid://csspyy43sohfl
|
||||
@@ -0,0 +1,6 @@
|
||||
[gd_scene format=3 uid="uid://dq6ifketavnfu"]
|
||||
|
||||
[node name="Collision Loading Zone" type="Area2D" unique_id=1043800735 groups=["Collision Loading Zone Group"]]
|
||||
collision_layer = 0
|
||||
|
||||
[connection signal="body_entered" from="." to="." method="_on_body_entered"]
|
||||
@@ -0,0 +1,6 @@
|
||||
[gd_scene format=3 uid="uid://bbules4o3xayc"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bqedrioybnvi5" path="res://Entities/Map Objects/Loading Zone/Scripts/entrance_transporter.gd" id="1_bkamm"]
|
||||
|
||||
[node name="Entrance Transporter" type="Node" unique_id=1690817663 groups=["Loading Zone Transporter Group"]]
|
||||
script = ExtResource("1_bkamm")
|
||||
@@ -1,6 +1,6 @@
|
||||
[gd_scene format=3 uid="uid://cla2d3gii8qda"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://dla7fe0nsbdvv" path="res://Scripts/Objects/Loading Zone/interactive_loading_zone.gd" id="1_7bdbd"]
|
||||
[ext_resource type="Script" uid="uid://csspyy43sohfl" path="res://Entities/Map Objects/Loading Zone/Scripts/interactive_loading_zone.gd" id="1_7bdbd"]
|
||||
|
||||
[node name="Interactive Loading Zone" type="Area2D" unique_id=1427014981 groups=["Interactive Loading Zone Group"]]
|
||||
collision_layer = 2
|
||||
@@ -1,7 +1,7 @@
|
||||
[gd_scene format=3 uid="uid://b8m08wroe1qu2"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://k2htcxstdj5v" path="res://Assets/Spritesheets/Outdoor Objects/Arrow Target-Sheet.png" id="1_b0s8y"]
|
||||
[ext_resource type="Script" uid="uid://6jls1eokv2to" path="res://Scripts/Objects/arrow_target.gd" id="1_uhut5"]
|
||||
[ext_resource type="Script" uid="uid://6jls1eokv2to" path="res://Entities/Map Objects/Mechanisms/Scripts/arrow_target.gd" id="1_uhut5"]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_uhut5"]
|
||||
radius = 8.0
|
||||
@@ -1,6 +1,6 @@
|
||||
[gd_scene format=3 uid="uid://b5t4h63xhuods"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://cxt7ht66jiac8" path="res://Scripts/Objects/Mechanisms/pressure_plate.gd" id="1_po2h8"]
|
||||
[ext_resource type="Script" uid="uid://cxt7ht66jiac8" path="res://Entities/Map Objects/Mechanisms/Scripts/pressure_plate.gd" id="1_po2h8"]
|
||||
[ext_resource type="Texture2D" uid="uid://dhtolttw5h33" path="res://Assets/Spritesheets/Mechanisms/Pressure Plate.png" id="1_ulio5"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_ulio5"]
|
||||
@@ -1,6 +1,6 @@
|
||||
[gd_scene format=3 uid="uid://ddgeo3vwebqeg"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://cggyjxrk4qqfm" path="res://Scripts/Objects/shop_item.gd" id="1_0luup"]
|
||||
[ext_resource type="Script" uid="uid://cggyjxrk4qqfm" path="res://Entities/Map Objects/Mechanisms/Scripts/shop_item.gd" id="1_0luup"]
|
||||
|
||||
[node name="ShopItem" type="Area2D" unique_id=1768344009]
|
||||
collision_layer = 2
|
||||
@@ -4,6 +4,12 @@ extends Node2D
|
||||
@export var spawn_markers: Node2D
|
||||
@export var destination_markers: Node2D
|
||||
|
||||
# Debug
|
||||
@export var should_log_schedule := false
|
||||
|
||||
@export_range(0.0, 60.0) var minimum_schedule_gap := 20.0
|
||||
@export_range(1.0, 61.0) var maximum_schedule_gap := 60.0
|
||||
|
||||
var _spawn_markers: Array[Marker2D] = []
|
||||
var _destination_markers: Array[Marker2D] = []
|
||||
var _spawn_schedule := 0.0
|
||||
@@ -20,12 +26,10 @@ func _ready() -> void:
|
||||
_set_random_spawn_schedule()
|
||||
|
||||
# At spawn, we might want to spawn some leaves sooner...
|
||||
_spawn_schedule -= randf_range(0.0, 15.0)
|
||||
_spawn_schedule -= randf_range(0.0, _spawn_schedule)
|
||||
_spawn_schedule = max(0, _spawn_schedule)
|
||||
print("%s - Leaf Spawn Schedule: %f" % [get_parent().name, _spawn_schedule])
|
||||
|
||||
# Debug
|
||||
_spawn_schedule = randf_range(1.0, 3.0)
|
||||
_log_schedule()
|
||||
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
@@ -33,6 +37,7 @@ func _process(delta: float) -> void:
|
||||
if _spawn_timer >= _spawn_schedule:
|
||||
_spawn_timer = 0.0
|
||||
_set_random_spawn_schedule()
|
||||
_log_schedule()
|
||||
|
||||
var spawn := _get_random_spawn_point()
|
||||
var destination := _get_random_destination_point()
|
||||
@@ -61,7 +66,7 @@ func _process(delta: float) -> void:
|
||||
|
||||
|
||||
func _set_random_spawn_schedule() -> void:
|
||||
_spawn_schedule = randf_range(20.0, 60.0)
|
||||
_spawn_schedule = randf_range(minimum_schedule_gap, maximum_schedule_gap)
|
||||
|
||||
|
||||
func _get_random_spawn_point() -> Vector2:
|
||||
@@ -76,3 +81,8 @@ func _get_random_destination_point() -> Vector2:
|
||||
var offset := Vector2(randf_range(-5.0, 5.0), randf_range(-5.0, 5.0))
|
||||
|
||||
return marker.position + offset
|
||||
|
||||
|
||||
func _log_schedule() -> void:
|
||||
if should_log_schedule:
|
||||
print("%s - Leaf Spawn Schedule: %f" % [get_parent().name, _spawn_schedule])
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user