Compare commits
3 Commits
86e3198645
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 7cd34cb07e | |||
| 5fb4a96159 | |||
| bfe4f7d6a9 |
3
.gitignore
vendored
3
.gitignore
vendored
@@ -17,3 +17,6 @@ mono_crash.*.json
|
|||||||
|
|
||||||
# Android build files
|
# Android build files
|
||||||
/android/
|
/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
|
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
|
@onready var animated_sprite_2d: AnimatedSprite2D = $AnimatedSprite2D
|
||||||
|
|
||||||
var current_state := States.IDLE
|
var current_state := States.IDLE
|
||||||
@@ -23,11 +27,12 @@ func _process(delta: float) -> void:
|
|||||||
animated_sprite_2d.play("pecking")
|
animated_sprite_2d.play("pecking")
|
||||||
await animated_sprite_2d.animation_finished
|
await animated_sprite_2d.animation_finished
|
||||||
animated_sprite_2d.play("idle")
|
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
|
pecking_timer = 0
|
||||||
current_state = States.IDLE
|
current_state = States.IDLE
|
||||||
_print_sched()
|
_print_sched()
|
||||||
|
|
||||||
|
|
||||||
func _print_sched() -> void:
|
func _print_sched() -> void:
|
||||||
|
if should_log_pecking_schedule:
|
||||||
print("%s Pecking Schedule: %f" % [name, pecking_sched])
|
print("%s Pecking Schedule: %f" % [name, pecking_sched])
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
[gd_scene format=3 uid="uid://clqfyxjtn67m"]
|
[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"]
|
[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"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_etrql"]
|
||||||
@@ -3,35 +3,36 @@ extends BaseState
|
|||||||
signal PlayerBeganDrawingBow
|
signal PlayerBeganDrawingBow
|
||||||
|
|
||||||
@export var strafing_speed := 35
|
@export var strafing_speed := 35
|
||||||
@export var movement_componenent: MovementComponent
|
|
||||||
@export var body: CharacterBody2D
|
@export var body: CharacterBody2D
|
||||||
|
|
||||||
var used_item_action: String
|
var _used_item_action: String
|
||||||
var animation_finished := false
|
var _animation_finished := false
|
||||||
|
var _movement_componenent: MovementComponent
|
||||||
|
|
||||||
func GetStateEnum() -> PlayerStateMachine.States:
|
func GetStateEnum() -> PlayerStateMachine.States:
|
||||||
return PlayerStateMachine.States.DRAWING_BOW
|
return PlayerStateMachine.States.DRAWING_BOW
|
||||||
|
|
||||||
|
|
||||||
func Enter(extra_parameters: Dictionary) -> void:
|
func Enter(extra_parameters: Dictionary) -> void:
|
||||||
animation_finished = false
|
_animation_finished = false
|
||||||
used_item_action = extra_parameters.action_name
|
_used_item_action = extra_parameters.action_name
|
||||||
|
_movement_componenent = ComponentUtils.GetMovementComponent(body)
|
||||||
PlayerBeganDrawingBow.emit()
|
PlayerBeganDrawingBow.emit()
|
||||||
|
|
||||||
|
|
||||||
func Update(_delta: float) -> void:
|
func Update(_delta: float) -> void:
|
||||||
if !animation_finished:
|
if !_animation_finished:
|
||||||
return
|
return
|
||||||
|
|
||||||
if !Input.is_action_pressed(used_item_action):
|
if !Input.is_action_pressed(_used_item_action):
|
||||||
state_machine.QueueStateChange(PlayerStateMachine.States.FIRING_ARROW)
|
state_machine.QueueStateChange(PlayerStateMachine.States.FIRING_ARROW)
|
||||||
return
|
return
|
||||||
|
|
||||||
var movement_vector := movement_componenent.movement_vector
|
var movement_vector := _movement_componenent.movement_vector
|
||||||
if movement_vector != Vector2.ZERO:
|
if movement_vector != Vector2.ZERO:
|
||||||
body.velocity = movement_vector * strafing_speed
|
body.velocity = movement_vector * strafing_speed
|
||||||
body.move_and_slide()
|
body.move_and_slide()
|
||||||
|
|
||||||
|
|
||||||
func OnDrawingBowAnimationFinished() -> void:
|
func OnDrawingBowAnimationFinished() -> void:
|
||||||
animation_finished = true
|
_animation_finished = true
|
||||||
@@ -1,10 +1,11 @@
|
|||||||
extends BaseState
|
extends BaseState
|
||||||
class_name PlayerIdleState
|
class_name PlayerIdleState
|
||||||
|
|
||||||
@export var movement_component: MovementComponent
|
|
||||||
|
|
||||||
signal PlayerBecameIdle
|
signal PlayerBecameIdle
|
||||||
|
|
||||||
|
@export var player: PlayerCharacter
|
||||||
|
|
||||||
|
var _movement_component: MovementComponent
|
||||||
var _sit_queued := false
|
var _sit_queued := false
|
||||||
var _sit_queue_pos: Vector2
|
var _sit_queue_pos: Vector2
|
||||||
var _sit_queue_dir: Enums.Directions
|
var _sit_queue_dir: Enums.Directions
|
||||||
@@ -15,6 +16,10 @@ func GetStateEnum() -> PlayerStateMachine.States:
|
|||||||
|
|
||||||
|
|
||||||
func Enter(_extra_parameters: Dictionary) -> void:
|
func Enter(_extra_parameters: Dictionary) -> void:
|
||||||
|
_movement_component = ComponentUtils.GetMovementComponent(player)
|
||||||
|
if not _movement_component:
|
||||||
|
print_rich("[color=yellow]Warning: Player does not have a movement component...[/color]")
|
||||||
|
|
||||||
PlayerBecameIdle.emit()
|
PlayerBecameIdle.emit()
|
||||||
|
|
||||||
|
|
||||||
@@ -30,7 +35,7 @@ func Update(_delta: float) -> void:
|
|||||||
_sit_queued = false
|
_sit_queued = false
|
||||||
return
|
return
|
||||||
|
|
||||||
if movement_component.movement_vector != Vector2.ZERO:
|
if _movement_component and _movement_component.movement_vector != Vector2.ZERO:
|
||||||
state_machine.QueueStateChange(PlayerStateMachine.States.WALKING)
|
state_machine.QueueStateChange(PlayerStateMachine.States.WALKING)
|
||||||
|
|
||||||
|
|
||||||
@@ -3,24 +3,27 @@ extends BaseState
|
|||||||
signal StartedWalking
|
signal StartedWalking
|
||||||
|
|
||||||
@export var walking_speed := 100
|
@export var walking_speed := 100
|
||||||
@export var movement_component: MovementComponent
|
|
||||||
@export var direction_component: FacingDirectionComponent
|
@export var direction_component: FacingDirectionComponent
|
||||||
@export var body: CharacterBody2D
|
@export var body: CharacterBody2D
|
||||||
|
|
||||||
|
var _movement_component: MovementComponent
|
||||||
|
|
||||||
func GetStateEnum() -> PlayerStateMachine.States:
|
func GetStateEnum() -> PlayerStateMachine.States:
|
||||||
return PlayerStateMachine.States.WALKING
|
return PlayerStateMachine.States.WALKING
|
||||||
|
|
||||||
|
|
||||||
func Enter(_extra_parameters: Dictionary) -> void:
|
func Enter(_extra_parameters: Dictionary) -> void:
|
||||||
|
_movement_component = ComponentUtils.GetMovementComponent(body)
|
||||||
StartedWalking.emit()
|
StartedWalking.emit()
|
||||||
|
|
||||||
|
|
||||||
func Update(_delta: float) -> void:
|
func Update(_delta: float) -> void:
|
||||||
if movement_component.movement_vector == Vector2.ZERO:
|
var movement_vector := _movement_component.movement_vector
|
||||||
|
|
||||||
|
if movement_vector == Vector2.ZERO:
|
||||||
state_machine.QueueStateChange(PlayerStateMachine.States.IDLE)
|
state_machine.QueueStateChange(PlayerStateMachine.States.IDLE)
|
||||||
return
|
return
|
||||||
|
|
||||||
var movement_vector := movement_component.movement_vector
|
|
||||||
body.velocity = movement_vector * walking_speed
|
body.velocity = movement_vector * walking_speed
|
||||||
body.move_and_slide()
|
body.move_and_slide()
|
||||||
|
|
||||||
@@ -3,9 +3,6 @@ class_name MovementComponent
|
|||||||
|
|
||||||
signal MovementInput(movement_vector: Vector2)
|
signal MovementInput(movement_vector: Vector2)
|
||||||
|
|
||||||
# Dynamic Exports
|
|
||||||
@export var body: CharacterBody2D
|
|
||||||
|
|
||||||
var movement_vector: Vector2
|
var movement_vector: Vector2
|
||||||
|
|
||||||
func _physics_process(_delta: float) -> void:
|
func _physics_process(_delta: float) -> void:
|
||||||
@@ -1,19 +1,18 @@
|
|||||||
[gd_scene format=3 uid="uid://6athlweutl2g"]
|
[gd_scene format=3 uid="uid://6athlweutl2g"]
|
||||||
|
|
||||||
[ext_resource type="PackedScene" uid="uid://uyl0s1e67x6s" path="res://Scenes/Characters/Player/sprite.tscn" id="1_27cb7"]
|
[ext_resource type="PackedScene" uid="uid://uyl0s1e67x6s" path="res://Entities/Characters/Player/sprite.tscn" id="1_27cb7"]
|
||||||
[ext_resource type="PackedScene" uid="uid://c2ydbmmvnfca6" path="res://Scenes/Characters/Player/state_machine.tscn" id="1_lyjr2"]
|
[ext_resource type="PackedScene" uid="uid://c2ydbmmvnfca6" path="res://Entities/Characters/Player/state_machine.tscn" id="1_lyjr2"]
|
||||||
[ext_resource type="Script" uid="uid://dacvayqstkvws" path="res://Scripts/Characters/Player/player.gd" id="1_qqvsf"]
|
[ext_resource type="Script" uid="uid://dacvayqstkvws" path="res://Entities/Characters/Player/Scripts/player.gd" id="1_qqvsf"]
|
||||||
[ext_resource type="Script" uid="uid://b0l02v61if6k8" path="res://Scripts/Components/facing_direction_component.gd" id="1_siygm"]
|
[ext_resource type="Script" uid="uid://b0l02v61if6k8" path="res://Scripts/Components/facing_direction_component.gd" id="1_siygm"]
|
||||||
[ext_resource type="Script" uid="uid://dwclkwbig1uii" path="res://Scripts/Characters/Player/movement_component.gd" id="4_apx8m"]
|
[ext_resource type="Script" uid="uid://dkmc1t43gomdb" path="res://Entities/Characters/Player/Scripts/States/idle_state.gd" id="4_dxcao"]
|
||||||
[ext_resource type="Script" uid="uid://dkmc1t43gomdb" path="res://Scripts/Characters/Player/States/idle_state.gd" id="4_dxcao"]
|
[ext_resource type="Script" uid="uid://ckn7gmtc23b8l" path="res://Entities/Characters/Player/Scripts/States/using_item_a_state.gd" id="5_1mdwi"]
|
||||||
[ext_resource type="Script" uid="uid://ckn7gmtc23b8l" path="res://Scripts/Characters/Player/States/using_item_a_state.gd" id="5_1mdwi"]
|
[ext_resource type="Script" uid="uid://bwmmah30t3m0u" path="res://Entities/Characters/Player/Scripts/States/walking_state.gd" id="5_cscr0"]
|
||||||
[ext_resource type="Script" uid="uid://bwmmah30t3m0u" path="res://Scripts/Characters/Player/States/walking_state.gd" id="5_cscr0"]
|
[ext_resource type="Script" uid="uid://brlisuoocwehh" path="res://Entities/Characters/Player/Scripts/interact_scanner.gd" id="6_fu1fx"]
|
||||||
[ext_resource type="Script" uid="uid://brlisuoocwehh" path="res://Scripts/Characters/Player/interact_scanner.gd" id="6_fu1fx"]
|
[ext_resource type="Script" uid="uid://bnp1vowmu15lg" path="res://Entities/Characters/Player/Scripts/States/drawing_bow_state.gd" id="7_cscr0"]
|
||||||
[ext_resource type="Script" uid="uid://bnp1vowmu15lg" path="res://Scripts/Characters/Player/States/drawing_bow_state.gd" id="7_cscr0"]
|
[ext_resource type="Script" uid="uid://cd2ewadcm8oi5" path="res://Entities/Characters/Player/Scripts/States/firing_arrow_state.gd" id="8_plevq"]
|
||||||
[ext_resource type="Script" uid="uid://cd2ewadcm8oi5" path="res://Scripts/Characters/Player/States/firing_arrow_state.gd" id="8_plevq"]
|
[ext_resource type="Script" uid="uid://bx1a35al4yiej" path="res://Entities/Characters/Player/Scripts/States/sitting_state.gd" id="9_sdxbo"]
|
||||||
[ext_resource type="Script" uid="uid://bx1a35al4yiej" path="res://Scripts/Characters/Player/States/sitting_state.gd" id="9_sdxbo"]
|
[ext_resource type="Script" uid="uid://bnontuqj3cnom" path="res://Entities/Characters/Player/Scripts/States/cutscene_state.gd" id="10_p06rw"]
|
||||||
[ext_resource type="Script" uid="uid://bnontuqj3cnom" path="res://Scripts/Characters/Player/States/cutscene_state.gd" id="10_p06rw"]
|
[ext_resource type="Script" uid="uid://wfdtd3xlgrvm" path="res://Entities/Characters/Player/Scripts/States/play_animation_state.gd" id="12_aencf"]
|
||||||
[ext_resource type="Script" uid="uid://wfdtd3xlgrvm" path="res://Scripts/Characters/Player/States/play_animation_state.gd" id="12_aencf"]
|
|
||||||
|
|
||||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_apx8m"]
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_apx8m"]
|
||||||
size = Vector2(10, 5)
|
size = Vector2(10, 5)
|
||||||
@@ -40,24 +39,19 @@ shape = SubResource("RectangleShape2D_apx8m")
|
|||||||
[node name="FacingDirectionComponent" type="Node" parent="Components" unique_id=408127032]
|
[node name="FacingDirectionComponent" type="Node" parent="Components" unique_id=408127032]
|
||||||
script = ExtResource("1_siygm")
|
script = ExtResource("1_siygm")
|
||||||
|
|
||||||
[node name="MovementComponent" type="Node" parent="Components" unique_id=1773880772 node_paths=PackedStringArray("body")]
|
|
||||||
script = ExtResource("4_apx8m")
|
|
||||||
body = NodePath("../..")
|
|
||||||
|
|
||||||
[node name="State Machine" parent="." unique_id=732559774 node_paths=PackedStringArray("states_container", "current_state") instance=ExtResource("1_lyjr2")]
|
[node name="State Machine" parent="." unique_id=732559774 node_paths=PackedStringArray("states_container", "current_state") instance=ExtResource("1_lyjr2")]
|
||||||
states_container = NodePath("States")
|
states_container = NodePath("States")
|
||||||
current_state = NodePath("States/Idle State")
|
current_state = NodePath("States/Idle State")
|
||||||
|
|
||||||
[node name="States" type="Node" parent="State Machine" unique_id=1171587216]
|
[node name="States" type="Node" parent="State Machine" unique_id=1171587216]
|
||||||
|
|
||||||
[node name="Idle State" type="Node" parent="State Machine/States" unique_id=2017409248 node_paths=PackedStringArray("movement_component", "state_machine")]
|
[node name="Idle State" type="Node" parent="State Machine/States" unique_id=2017409248 node_paths=PackedStringArray("player", "state_machine")]
|
||||||
script = ExtResource("4_dxcao")
|
script = ExtResource("4_dxcao")
|
||||||
movement_component = NodePath("../../../Components/MovementComponent")
|
player = NodePath("../../..")
|
||||||
state_machine = NodePath("../..")
|
state_machine = NodePath("../..")
|
||||||
|
|
||||||
[node name="Walking State" type="Node" parent="State Machine/States" unique_id=1661048365 node_paths=PackedStringArray("movement_component", "direction_component", "body", "state_machine")]
|
[node name="Walking State" type="Node" parent="State Machine/States" unique_id=1661048365 node_paths=PackedStringArray("direction_component", "body", "state_machine")]
|
||||||
script = ExtResource("5_cscr0")
|
script = ExtResource("5_cscr0")
|
||||||
movement_component = NodePath("../../../Components/MovementComponent")
|
|
||||||
direction_component = NodePath("../../../Components/FacingDirectionComponent")
|
direction_component = NodePath("../../../Components/FacingDirectionComponent")
|
||||||
body = NodePath("../../..")
|
body = NodePath("../../..")
|
||||||
state_machine = NodePath("../..")
|
state_machine = NodePath("../..")
|
||||||
@@ -68,9 +62,8 @@ body = NodePath("../../..")
|
|||||||
direction_component = NodePath("../../../Components/FacingDirectionComponent")
|
direction_component = NodePath("../../../Components/FacingDirectionComponent")
|
||||||
state_machine = NodePath("../..")
|
state_machine = NodePath("../..")
|
||||||
|
|
||||||
[node name="Drawing Bow State" type="Node" parent="State Machine/States" unique_id=317681716 node_paths=PackedStringArray("movement_componenent", "body", "state_machine")]
|
[node name="Drawing Bow State" type="Node" parent="State Machine/States" unique_id=317681716 node_paths=PackedStringArray("body", "state_machine")]
|
||||||
script = ExtResource("7_cscr0")
|
script = ExtResource("7_cscr0")
|
||||||
movement_componenent = NodePath("../../../Components/MovementComponent")
|
|
||||||
body = NodePath("../../..")
|
body = NodePath("../../..")
|
||||||
state_machine = NodePath("../..")
|
state_machine = NodePath("../..")
|
||||||
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
[gd_scene format=3 uid="uid://uyl0s1e67x6s"]
|
[gd_scene format=3 uid="uid://uyl0s1e67x6s"]
|
||||||
|
|
||||||
[ext_resource type="Texture2D" uid="uid://de0ihg453ruyi" path="res://Assets/Spritesheets/Player/Player_Base_animations.png" id="1_45g06"]
|
[ext_resource type="Texture2D" uid="uid://de0ihg453ruyi" path="res://Assets/Spritesheets/Player/Player_Base_animations.png" id="1_45g06"]
|
||||||
[ext_resource type="Script" uid="uid://cuar23q48cbja" path="res://Scripts/Characters/Player/sprite.gd" id="1_jqxwg"]
|
[ext_resource type="Script" uid="uid://cuar23q48cbja" path="res://Entities/Characters/Player/Scripts/sprite.gd" id="1_jqxwg"]
|
||||||
[ext_resource type="Texture2D" uid="uid://1g5dx0dbupwk" path="res://Assets/Spritesheets/Player/Hair_1_Blonde.png" id="2_jqxwg"]
|
[ext_resource type="Texture2D" uid="uid://1g5dx0dbupwk" path="res://Assets/Spritesheets/Player/Hair_1_Blonde.png" id="2_jqxwg"]
|
||||||
[ext_resource type="Texture2D" uid="uid://d1mourl3rq437" path="res://Assets/Spritesheets/Player/player-full-01.png" id="2_ndjja"]
|
[ext_resource type="Texture2D" uid="uid://d1mourl3rq437" path="res://Assets/Spritesheets/Player/player-full-01.png" id="2_ndjja"]
|
||||||
[ext_resource type="Texture2D" uid="uid://4mpha6wuvyfy" path="res://Assets/Spritesheets/Player/Farmer_Shirt_1_Black.png" id="3_ndjja"]
|
[ext_resource type="Texture2D" uid="uid://4mpha6wuvyfy" path="res://Assets/Spritesheets/Player/Farmer_Shirt_1_Black.png" id="3_ndjja"]
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
[gd_scene format=3 uid="uid://c2ydbmmvnfca6"]
|
[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="StateMachine" type="Node" unique_id=732559774]
|
||||||
script = ExtResource("1_clu2m")
|
script = ExtResource("1_clu2m")
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
[gd_scene format=3 uid="uid://nbkisxm2oekn"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://dwclkwbig1uii" path="res://Entities/Characters/Player/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"]
|
[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]
|
[node name="Occlusion Culler" type="Area2D" unique_id=1362480066]
|
||||||
collision_layer = 0
|
collision_layer = 0
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
[gd_scene format=3 uid="uid://cd3iyspcdg8m"]
|
[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"]]
|
[node name="Base Chest" type="StaticBody2D" unique_id=975880832 groups=["Treasure Chest Group"]]
|
||||||
y_sort_enabled = true
|
y_sort_enabled = true
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
[gd_scene format=3 uid="uid://cncm0c4dmosgs"]
|
[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]
|
[node name="Base Item Chest" type="StaticBody2D" unique_id=991903258]
|
||||||
script = ExtResource("1_mkt0u")
|
script = ExtResource("1_mkt0u")
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
[gd_scene format=3 uid="uid://byp273amg5ji8"]
|
[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="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://Scenes/Animated Sprites/chest01_sprite.tscn" id="2_iwcc8"]
|
[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"]
|
[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"]
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_y3ooa"]
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
[gd_scene format=3 uid="uid://b7u4hlvuqiefn"]
|
[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="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://Scenes/Animated Sprites/chest01_sprite.tscn" id="2_jpeii"]
|
[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"]
|
[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"]
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_y3ooa"]
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
extends StaticBody2D
|
extends StaticBody2D
|
||||||
class_name BaseChest
|
class_name BaseChest
|
||||||
|
|
||||||
|
signal ChestOpened
|
||||||
signal OpeningAnimationStarted
|
signal OpeningAnimationStarted
|
||||||
|
|
||||||
@export var is_open := false
|
@export var is_open := false
|
||||||
@@ -8,7 +9,12 @@ signal OpeningAnimationStarted
|
|||||||
# Public Methods
|
# Public Methods
|
||||||
func Open() -> void:
|
func Open() -> void:
|
||||||
is_open = true
|
is_open = true
|
||||||
|
ChestOpened.emit()
|
||||||
|
|
||||||
|
|
||||||
func OpenAlreadyOpened() -> void:
|
func OpenAlreadyOpened() -> void:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
func SetOpenedFromLoad() -> void:
|
||||||
|
is_open = true
|
||||||
@@ -27,6 +27,11 @@ func OpenAlreadyOpened() -> void:
|
|||||||
already_opened_message_dialogue_trigger.Trigger()
|
already_opened_message_dialogue_trigger.Trigger()
|
||||||
|
|
||||||
|
|
||||||
|
func SetOpenedFromLoad() -> void:
|
||||||
|
super.SetOpenedFromLoad()
|
||||||
|
chest_01_sprite.play("opened")
|
||||||
|
|
||||||
|
|
||||||
# Private Methods
|
# Private Methods
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
if is_open:
|
if is_open:
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
[gd_scene format=3 uid="uid://23tpba4r6ucg"]
|
[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="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"]
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_nv27i"]
|
||||||
size = Vector2(30, 11)
|
size = Vector2(30, 11)
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
[gd_scene format=3 uid="uid://b60nr4wfvijpf"]
|
[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"]]
|
[node name="Dialogue Trigger" type="Area2D" unique_id=189867444 groups=["Dialog Trigger Group"]]
|
||||||
collision_layer = 2
|
collision_layer = 2
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
extends StaticBody2D
|
extends StaticBody2D
|
||||||
|
|
||||||
|
signal Opened
|
||||||
|
|
||||||
@onready var sprite: AnimatedSprite2D = $AnimatedSprite2D
|
@onready var sprite: AnimatedSprite2D = $AnimatedSprite2D
|
||||||
@onready var collision_shape_2d: CollisionShape2D = $CollisionShape2D
|
@onready var collision_shape_2d: CollisionShape2D = $CollisionShape2D
|
||||||
|
|
||||||
@@ -15,3 +17,5 @@ func OpenGate() -> void:
|
|||||||
|
|
||||||
collision_shape_2d.set_deferred("disabled", true)
|
collision_shape_2d.set_deferred("disabled", true)
|
||||||
sprite.play("open")
|
sprite.play("open")
|
||||||
|
|
||||||
|
Opened.emit()
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
[gd_scene format=3 uid="uid://da4qqruhldc6b"]
|
[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="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"]
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_5ttkm"]
|
||||||
size = Vector2(29, 4)
|
size = Vector2(29, 4)
|
||||||
@@ -395,6 +395,6 @@ shape = SubResource("RectangleShape2D_5ttkm")
|
|||||||
y_sort_enabled = true
|
y_sort_enabled = true
|
||||||
position = Vector2(0, 15)
|
position = Vector2(0, 15)
|
||||||
sprite_frames = SubResource("SpriteFrames_pki7h")
|
sprite_frames = SubResource("SpriteFrames_pki7h")
|
||||||
animation = &"closed"
|
animation = &"open"
|
||||||
autoplay = "closed"
|
autoplay = "closed"
|
||||||
offset = Vector2(0, -15)
|
offset = Vector2(0, -15)
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://ckfuj0lm6jv3i
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://csspyy43sohfl
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://bvl1vdqd5cjkc
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
[gd_scene format=3 uid="uid://ca75b65eh7vv8"]
|
[gd_scene format=3 uid="uid://ca75b65eh7vv8"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://g0r5waf50gp5" path="res://Scripts/Objects/Loading Zone/collision_loading_zone.gd" id="1_pb5hg"]
|
[ext_resource type="Script" uid="uid://ckfuj0lm6jv3i" path="res://Entities/Map Objects/Loading Zone/Scripts/collision_loading_zone.gd" id="1_pb5hg"]
|
||||||
|
|
||||||
[node name="Collision Loading Zone" type="Area2D" unique_id=1043800735 groups=["Collision Loading Zone Group"]]
|
[node name="Collision Loading Zone" type="Area2D" unique_id=1043800735 groups=["Collision Loading Zone Group"]]
|
||||||
collision_layer = 0
|
collision_layer = 0
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
[gd_scene format=3 uid="uid://cla2d3gii8qda"]
|
[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"]]
|
[node name="Interactive Loading Zone" type="Area2D" unique_id=1427014981 groups=["Interactive Loading Zone Group"]]
|
||||||
collision_layer = 2
|
collision_layer = 2
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
[gd_scene format=3 uid="uid://bbules4o3xayc"]
|
[gd_scene format=3 uid="uid://bbules4o3xayc"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://cshtpe5n2iubh" path="res://Scripts/Objects/Loading Zone/loading_zone_transporter.gd" id="1_p8o2m"]
|
[ext_resource type="Script" uid="uid://bvl1vdqd5cjkc" path="res://Entities/Map Objects/Loading Zone/Scripts/loading_zone_transporter.gd" id="1_p8o2m"]
|
||||||
|
|
||||||
[node name="Loading Zone Transporter" type="Node" unique_id=1690817663 groups=["Loading Zone Transporter Group"]]
|
[node name="Loading Zone Transporter" type="Node" unique_id=1690817663 groups=["Loading Zone Transporter Group"]]
|
||||||
script = ExtResource("1_p8o2m")
|
script = ExtResource("1_p8o2m")
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
[gd_scene format=3 uid="uid://b8m08wroe1qu2"]
|
[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="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"]
|
[sub_resource type="CircleShape2D" id="CircleShape2D_uhut5"]
|
||||||
radius = 8.0
|
radius = 8.0
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
[gd_scene format=3 uid="uid://b5t4h63xhuods"]
|
[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"]
|
[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"]
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_ulio5"]
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
[gd_scene format=3 uid="uid://ddgeo3vwebqeg"]
|
[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]
|
[node name="ShopItem" type="Area2D" unique_id=1768344009]
|
||||||
collision_layer = 2
|
collision_layer = 2
|
||||||
@@ -4,6 +4,12 @@ extends Node2D
|
|||||||
@export var spawn_markers: Node2D
|
@export var spawn_markers: Node2D
|
||||||
@export var destination_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 _spawn_markers: Array[Marker2D] = []
|
||||||
var _destination_markers: Array[Marker2D] = []
|
var _destination_markers: Array[Marker2D] = []
|
||||||
var _spawn_schedule := 0.0
|
var _spawn_schedule := 0.0
|
||||||
@@ -20,12 +26,10 @@ func _ready() -> void:
|
|||||||
_set_random_spawn_schedule()
|
_set_random_spawn_schedule()
|
||||||
|
|
||||||
# At spawn, we might want to spawn some leaves sooner...
|
# 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)
|
_spawn_schedule = max(0, _spawn_schedule)
|
||||||
print("%s - Leaf Spawn Schedule: %f" % [get_parent().name, _spawn_schedule])
|
|
||||||
|
|
||||||
# Debug
|
_log_schedule()
|
||||||
_spawn_schedule = randf_range(1.0, 3.0)
|
|
||||||
|
|
||||||
|
|
||||||
func _process(delta: float) -> void:
|
func _process(delta: float) -> void:
|
||||||
@@ -33,6 +37,7 @@ func _process(delta: float) -> void:
|
|||||||
if _spawn_timer >= _spawn_schedule:
|
if _spawn_timer >= _spawn_schedule:
|
||||||
_spawn_timer = 0.0
|
_spawn_timer = 0.0
|
||||||
_set_random_spawn_schedule()
|
_set_random_spawn_schedule()
|
||||||
|
_log_schedule()
|
||||||
|
|
||||||
var spawn := _get_random_spawn_point()
|
var spawn := _get_random_spawn_point()
|
||||||
var destination := _get_random_destination_point()
|
var destination := _get_random_destination_point()
|
||||||
@@ -61,7 +66,7 @@ func _process(delta: float) -> void:
|
|||||||
|
|
||||||
|
|
||||||
func _set_random_spawn_schedule() -> 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:
|
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))
|
var offset := Vector2(randf_range(-5.0, 5.0), randf_range(-5.0, 5.0))
|
||||||
|
|
||||||
return marker.position + offset
|
return marker.position + offset
|
||||||
|
|
||||||
|
|
||||||
|
func _log_schedule() -> void:
|
||||||
|
if should_log_schedule:
|
||||||
|
print("%s - Leaf Spawn Schedule: %f" % [get_parent().name, _spawn_schedule])
|
||||||
7
Entities/Map Objects/Trees/Effects/leaf_spawner.tscn
Normal file
7
Entities/Map Objects/Trees/Effects/leaf_spawner.tscn
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
[gd_scene format=3 uid="uid://dpwm1tn0mbr3l"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://vmyfl4obus88" path="res://Entities/Map Objects/Trees/Effects/Scripts/leaf_spawner.gd" id="1_l7yxv"]
|
||||||
|
|
||||||
|
[node name="Leaf Spawner" type="Node2D" unique_id=986945632]
|
||||||
|
y_sort_enabled = true
|
||||||
|
script = ExtResource("1_l7yxv")
|
||||||
102
Entities/Map Objects/Trees/tree_01.tscn
Normal file
102
Entities/Map Objects/Trees/tree_01.tscn
Normal file
@@ -0,0 +1,102 @@
|
|||||||
|
[gd_scene format=3 uid="uid://cc3qat6un2323"]
|
||||||
|
|
||||||
|
[ext_resource type="Texture2D" uid="uid://xygpf7c886pj" path="res://Assets/Spritesheets/Trees/Medium_Oak_Tree.png" id="1_i2ia5"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://d24gcv3umq60k" path="res://Entities/Characters/Utility/Occlusion/occlusion_culler.tscn" id="1_jbed0"]
|
||||||
|
|
||||||
|
[sub_resource type="CircleShape2D" id="CircleShape2D_jbed0"]
|
||||||
|
radius = 12.0
|
||||||
|
|
||||||
|
[sub_resource type="Shader" id="Shader_jbed0"]
|
||||||
|
code = "shader_type canvas_item;
|
||||||
|
|
||||||
|
uniform bool render_noise = false;
|
||||||
|
uniform sampler2D noise_texture : repeat_enable; // set in inspector
|
||||||
|
uniform float amplitude : hint_range(0.0, 0.5, 0.01) = 0.2;
|
||||||
|
uniform float time_scale : hint_range(0.0, 5.0, 0.01) = 0.04;
|
||||||
|
uniform float noise_scale : hint_range(0.0, 2.0, 0.0001) = 0.001;
|
||||||
|
uniform float rotation_strength : hint_range(0.0, 5.0, 0.1) = 1;
|
||||||
|
uniform vec2 rotation_pivot = vec2(0.5, 1);
|
||||||
|
varying vec2 world_position;
|
||||||
|
|
||||||
|
void vertex(){
|
||||||
|
world_position = (MODEL_MATRIX * vec4(VERTEX, 0.0, 1.0)).xy;
|
||||||
|
}
|
||||||
|
|
||||||
|
vec2 get_sample_pos(vec2 pos, float scale, float offset) {
|
||||||
|
pos *= scale;
|
||||||
|
pos += offset;
|
||||||
|
return pos;
|
||||||
|
}
|
||||||
|
|
||||||
|
vec2 rotate_vec(vec2 vec, vec2 pivot, float rotation) {
|
||||||
|
float cosa = cos(rotation);
|
||||||
|
float sina = sin(rotation);
|
||||||
|
vec -= pivot;
|
||||||
|
return vec2(
|
||||||
|
cosa * vec.x - sina * vec.y,
|
||||||
|
cosa * vec.y + sina * vec.x
|
||||||
|
) + pivot;
|
||||||
|
}
|
||||||
|
|
||||||
|
void fragment() {
|
||||||
|
// get noise from texture
|
||||||
|
vec2 noise_sample_pos = get_sample_pos(world_position, noise_scale, TIME * time_scale);
|
||||||
|
float noise_amount = texture(noise_texture, noise_sample_pos).r - 0.5f;
|
||||||
|
|
||||||
|
// get rotation position around a pivot
|
||||||
|
float rotation = amplitude * noise_amount;
|
||||||
|
vec2 rotated_uvs = rotate_vec(UV, rotation_pivot, rotation);
|
||||||
|
|
||||||
|
// blend original uvs and rotated uvs based on distance to pivot
|
||||||
|
float dist = distance(UV, rotation_pivot) * rotation_strength;
|
||||||
|
vec2 result_uvs = mix(UV, rotated_uvs, dist);
|
||||||
|
|
||||||
|
// output color
|
||||||
|
COLOR = texture(TEXTURE, result_uvs);
|
||||||
|
|
||||||
|
// optional, preview noise texture for debugging
|
||||||
|
if (render_noise) {
|
||||||
|
vec4 noise_color = texture(noise_texture, noise_sample_pos);
|
||||||
|
COLOR = noise_color;
|
||||||
|
}
|
||||||
|
}"
|
||||||
|
|
||||||
|
[sub_resource type="NoiseTexture2D" id="NoiseTexture2D_o0u4i"]
|
||||||
|
|
||||||
|
[sub_resource type="ShaderMaterial" id="ShaderMaterial_b23hf"]
|
||||||
|
shader = SubResource("Shader_jbed0")
|
||||||
|
shader_parameter/render_noise = false
|
||||||
|
shader_parameter/noise_texture = SubResource("NoiseTexture2D_o0u4i")
|
||||||
|
shader_parameter/amplitude = 0.05999999865888
|
||||||
|
shader_parameter/time_scale = 0.04
|
||||||
|
shader_parameter/noise_scale = 0.001
|
||||||
|
shader_parameter/rotation_strength = 1.0
|
||||||
|
shader_parameter/rotation_pivot = Vector2(0.5, 1)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_5otsd"]
|
||||||
|
atlas = ExtResource("1_i2ia5")
|
||||||
|
region = Rect2(32, 0, 32, 48)
|
||||||
|
|
||||||
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_0srx6"]
|
||||||
|
size = Vector2(6, 3)
|
||||||
|
|
||||||
|
[node name="Tree 01" type="StaticBody2D" unique_id=2046930104]
|
||||||
|
y_sort_enabled = true
|
||||||
|
|
||||||
|
[node name="Occlusion Culler" parent="." unique_id=1362480066 node_paths=PackedStringArray("nodes_to_occlude") instance=ExtResource("1_jbed0")]
|
||||||
|
nodes_to_occlude = [NodePath("../Sprite2D")]
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="Occlusion Culler" unique_id=731605527]
|
||||||
|
position = Vector2(0, -10)
|
||||||
|
shape = SubResource("CircleShape2D_jbed0")
|
||||||
|
|
||||||
|
[node name="Sprite2D" type="Sprite2D" parent="." unique_id=1420512565]
|
||||||
|
y_sort_enabled = true
|
||||||
|
material = SubResource("ShaderMaterial_b23hf")
|
||||||
|
position = Vector2(0, 8)
|
||||||
|
texture = SubResource("AtlasTexture_5otsd")
|
||||||
|
offset = Vector2(0, -8)
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=870152657]
|
||||||
|
position = Vector2(0, 6.5)
|
||||||
|
shape = SubResource("RectangleShape2D_0srx6")
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user