From 95c217be5c22db87e4918a61495c7cb5dada84e5 Mon Sep 17 00:00:00 2001 From: Dustin Date: Sat, 10 May 2025 08:52:25 -0700 Subject: [PATCH] Starting a series of test chambers. --- Main.tscn | 2 +- assets/Fonts/default_font.tres | 6 ++++ lib/classes/state_modifier_animation.gd | 8 +++--- lib/classes/state_modifier_movement.gd | 22 +++++++-------- lib/components/Modifier_Component.gd | 15 ---------- lib/components/Modifier_Receiver.gd | 2 +- src/Interactables/modifiers/icy_surface.tres | 21 ++++++++++++++ src/actors/players/playerE/PlayerE.tscn | 29 ++++++++++++-------- src/levels/CloneBox.tscn | 26 ++++++++++++++++-- 9 files changed, 85 insertions(+), 46 deletions(-) create mode 100644 assets/Fonts/default_font.tres create mode 100644 src/Interactables/modifiers/icy_surface.tres diff --git a/Main.tscn b/Main.tscn index bfd08ca..baee89c 100644 --- a/Main.tscn +++ b/Main.tscn @@ -2,7 +2,7 @@ [ext_resource path="res://src/classes/camera_guide.gd" type="Script" id=1] [ext_resource path="res://src/Camera2D.gd" type="Script" id=2] -[ext_resource path="res://src/levels/TestBox.tscn" type="PackedScene" id=3] +[ext_resource path="res://src/levels/CloneBox.tscn" type="PackedScene" id=3] [ext_resource path="res://src/ui/scene_transition.tscn" type="PackedScene" id=4] [ext_resource path="res://src/ui/HUD.tscn" type="PackedScene" id=5] [ext_resource path="res://src/Main.gd" type="Script" id=7] diff --git a/assets/Fonts/default_font.tres b/assets/Fonts/default_font.tres new file mode 100644 index 0000000..17bfbfa --- /dev/null +++ b/assets/Fonts/default_font.tres @@ -0,0 +1,6 @@ +[gd_resource type="Theme" load_steps=2 format=2] + +[ext_resource path="res://assets/Fonts/QuinqueFive.tres" type="DynamicFont" id=1] + +[resource] +default_font = ExtResource( 1 ) diff --git a/lib/classes/state_modifier_animation.gd b/lib/classes/state_modifier_animation.gd index c3a2bbc..5cde7d5 100644 --- a/lib/classes/state_modifier_animation.gd +++ b/lib/classes/state_modifier_animation.gd @@ -3,10 +3,10 @@ extends StateModifier ## Animation modifier variables ## The name of the animation that could be applied and starting frame -var animation_name: String = '' -var animation_suffix: String = '' -var animation_starting_frame: int = 0 -var animation_speed: float +export var animation_name: String = '' +export var animation_suffix: String = '' +export var animation_starting_frame: int = 0 +export var animation_speed: float enum SUB_TYPE { NONE, # Usually just a physics modifier diff --git a/lib/classes/state_modifier_movement.gd b/lib/classes/state_modifier_movement.gd index 6d13e2f..ff19008 100644 --- a/lib/classes/state_modifier_movement.gd +++ b/lib/classes/state_modifier_movement.gd @@ -2,26 +2,26 @@ class_name StateModifierMovement extends StateModifier ## Movement Modifiers -var horizontal_speed: float = 0 -var horizontal_acceleration: float = 0 +export var horizontal_speed: float = 0 +export var horizontal_acceleration: float = 0 ## Movement Speed Offsets (Positive or Negative) -var horizontal_speed_offset: float = 0 +export var horizontal_speed_offset: float = 0 ## Applies only if offset applies -var horizontal_speed_offset_acceleration: float = 0 -var jerk_factor: float = 0 +export var horizontal_speed_offset_acceleration: float = 0 +export var jerk_factor: float = 0 -var vertical_speed: float = 0 -var vertical_acceleration: float = 0 +export var vertical_speed: float = 0 +export var vertical_acceleration: float = 0 ## Movement Speed Offsets (Positive or Negative) -var vertical_speed_offset: float = 0 +export var vertical_speed_offset: float = 0 ## Applies only if offset applies -var vertical_speed_offset_acceleration: float = 0 +export var vertical_speed_offset_acceleration: float = 0 -var gravity: int = 0 +export var gravity: int = 0 ## Processing Directives (help determine how the merge function works) var direction :float = 0.0 # -1, 0, 1 -var only_grounded :float = false +export var only_grounded :float = false enum SUB_TYPE { NONE, # Basic physics modifier just adds numbers diff --git a/lib/components/Modifier_Component.gd b/lib/components/Modifier_Component.gd index a1b356a..c640c2a 100644 --- a/lib/components/Modifier_Component.gd +++ b/lib/components/Modifier_Component.gd @@ -4,19 +4,6 @@ export var modifier :Resource var modifier_type = 0 -export var modifier_name :String = '' -var animation_name: String = '' # Not using this one -var timeout_seconds: float = 0.0 # Not doing timeout based ones yet either. - -export var directional_modifier: bool = false - -export var move_speed: float = 0.0 -export var move_acceleration: float = 0.0 -export var move_speed_modifier: float = 0.0 -export var move_modifier_move_acceleration: float = 0.0 -export var jerk_factor: float = 0 - -export var gravity_modifier: int = 0 #var state_timeout: Timer @@ -39,8 +26,6 @@ func _ready(): # move_speed_modifier, # move_modifier_move_acceleration, # jerk_factor) - print("Debug Direction property shy are you stopid?! ", directional_modifier) - modifier.modifier_properties.directional_modifier = directional_modifier func _on_Modifier_Component_body_entered(body): var colliding_node = body diff --git a/lib/components/Modifier_Receiver.gd b/lib/components/Modifier_Receiver.gd index 0ef6f21..8f8176f 100644 --- a/lib/components/Modifier_Receiver.gd +++ b/lib/components/Modifier_Receiver.gd @@ -42,7 +42,7 @@ func _ready(): # Switching to a new model that starts with Hitbox func register_modifier(modifier: StateModifier): if enabled: - request_push_state_modifier.call_func(StateModifier) + request_push_state_modifier.call_func(modifier) # if modifier_collection.has(modifier) == false: # print("New Modifier Registered " + modifier.name) # modifier_collection.append(modifier) diff --git a/src/Interactables/modifiers/icy_surface.tres b/src/Interactables/modifiers/icy_surface.tres new file mode 100644 index 0000000..8b12af3 --- /dev/null +++ b/src/Interactables/modifiers/icy_surface.tres @@ -0,0 +1,21 @@ +[gd_resource type="Resource" load_steps=2 format=2] + +[ext_resource path="res://lib/classes/state_modifier_movement.gd" type="Script" id=1] + +[resource] +resource_local_to_scene = true +resource_name = "ice" +script = ExtResource( 1 ) +name = "ice_or_something" +timeout_seconds = 0.0 +horizontal_speed = 0.0 +horizontal_acceleration = 0.0 +horizontal_speed_offset = 0.0 +horizontal_speed_offset_acceleration = 0.0 +jerk_factor = 0.0 +vertical_speed = 0.0 +vertical_acceleration = 0.0 +vertical_speed_offset = 0.0 +vertical_speed_offset_acceleration = 0.0 +gravity = 0 +only_grounded = 0.0 diff --git a/src/actors/players/playerE/PlayerE.tscn b/src/actors/players/playerE/PlayerE.tscn index 5f4a47e..2acb3a8 100644 --- a/src/actors/players/playerE/PlayerE.tscn +++ b/src/actors/players/playerE/PlayerE.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=42 format=2] +[gd_scene load_steps=43 format=2] [ext_resource path="res://lib/parent_scenes/actor.tscn" type="PackedScene" id=1] [ext_resource path="res://assets/actors/players/playerE/PlayerE_SpriteFrames.tres" type="SpriteFrames" id=2] @@ -34,6 +34,7 @@ [ext_resource path="res://src/actors/players/playerE/Hitbox-CollisionShape2D_StateReceiver.gd" type="Script" id=32] [ext_resource path="res://lib/components/Hitbox_Component.tscn" type="PackedScene" id=33] [ext_resource path="res://src/actors/players/playerE/Hurtbox-CollisionShape2D_StateReceiver.gd" type="Script" id=34] +[ext_resource path="res://lib/components/Modifier_Receiver.tscn" type="PackedScene" id=35] [sub_resource type="Resource" id=3] resource_local_to_scene = true @@ -115,21 +116,25 @@ __meta__ = { [node name="Movement_StateReceiver" parent="." index="2"] script = ExtResource( 6 ) -[node name="LedgeDetector" type="RayCast2D" parent="." index="3"] +[node name="Modifier_Receiver" parent="." index="3" instance=ExtResource( 35 )] +callable_state_machine = NodePath("../Movement_StateMachine") +debug_receiver = true + +[node name="LedgeDetector" type="RayCast2D" parent="." index="4"] unique_name_in_owner = true modulate = Color( 0, 1, 0, 1 ) position = Vector2( 8, -10 ) enabled = true cast_to = Vector2( 1.36422e-12, -1 ) -[node name="WallDetector" type="RayCast2D" parent="." index="4"] +[node name="WallDetector" type="RayCast2D" parent="." index="5"] unique_name_in_owner = true modulate = Color( 0, 1, 0, 1 ) position = Vector2( 6, -16 ) enabled = true cast_to = Vector2( 4, 4 ) -[node name="LadderDetector" type="RayCast2D" parent="." index="5"] +[node name="LadderDetector" type="RayCast2D" parent="." index="6"] unique_name_in_owner = true modulate = Color( 0, 1, 0, 1 ) enabled = true @@ -138,25 +143,25 @@ collision_mask = 1024 collide_with_areas = true collide_with_bodies = false -[node name="AudioStreamPlayer_StateReceiver" parent="." index="6"] +[node name="AudioStreamPlayer_StateReceiver" parent="." index="7"] sound_effects = [ SubResource( 4 ), SubResource( 5 ), SubResource( 6 ) ] -[node name="CollisionShape2D" type="CollisionShape2D" parent="." index="7"] +[node name="CollisionShape2D" type="CollisionShape2D" parent="." index="8"] position = Vector2( 0, 2 ) shape = SubResource( 1 ) script = ExtResource( 31 ) callable_state_machine = NodePath("../Movement_StateMachine") -[node name="Health_Component" parent="." index="8" instance=ExtResource( 17 )] +[node name="Health_Component" parent="." index="9" instance=ExtResource( 17 )] unique_name_in_owner = true max_health = 100 -[node name="Stamina_Component" parent="." index="9" instance=ExtResource( 29 )] +[node name="Stamina_Component" parent="." index="10" instance=ExtResource( 29 )] unique_name_in_owner = true max_stamina = 50 recovery_rate = 2 -[node name="Hurtbox_Component" parent="." index="10" instance=ExtResource( 16 )] +[node name="Hurtbox_Component" parent="." index="11" instance=ExtResource( 16 )] collision_layer = 16 collision_mask = 128 hurtbox_entered_function = "hit_Receiver" @@ -168,13 +173,13 @@ shape = SubResource( 2 ) script = ExtResource( 34 ) callable_state_machine = NodePath("../../Movement_StateMachine") -[node name="Interactable_Receiver" type="Node" parent="." index="11"] +[node name="Interactable_Receiver" type="Node" parent="." index="12"] script = ExtResource( 21 ) interactable_parent_callback = "touch_the_thing" -[node name="PewMachine" parent="." index="12" instance=ExtResource( 28 )] +[node name="PewMachine" parent="." index="13" instance=ExtResource( 28 )] -[node name="Hitbox_Component" parent="." index="13" instance=ExtResource( 33 )] +[node name="Hitbox_Component" parent="." index="14" instance=ExtResource( 33 )] collision_layer = 192 damage_amount = 10 diff --git a/src/levels/CloneBox.tscn b/src/levels/CloneBox.tscn index 8538b43..a4135da 100644 --- a/src/levels/CloneBox.tscn +++ b/src/levels/CloneBox.tscn @@ -1,20 +1,25 @@ -[gd_scene load_steps=7 format=2] +[gd_scene load_steps=11 format=2] [ext_resource path="res://src/templates/level_templates/LevelTemplate.tscn" type="PackedScene" id=1] [ext_resource path="res://assets/levels/LegacyFantasy-High_Forest/tileset.tres" type="TileSet" id=2] [ext_resource path="res://lib/components/Hitbox_Component.tscn" type="PackedScene" id=3] [ext_resource path="res://src/Interactables/LevelTransition.tscn" type="PackedScene" id=4] +[ext_resource path="res://src/Interactables/modifiers/icy_surface.tres" type="Resource" id=5] +[ext_resource path="res://lib/components/Modifier_Component.tscn" type="PackedScene" id=6] +[ext_resource path="res://assets/Fonts/default_font.tres" type="Theme" id=7] [sub_resource type="CircleShape2D" id=1] radius = 5.09902 [sub_resource type="RectangleShape2D" id=2] +[sub_resource type="CircleShape2D" id=3] + [node name="CloneBox" groups=["world"] instance=ExtResource( 1 )] [node name="TileMap Collision" parent="." index="1"] tile_set = ExtResource( 2 ) -tile_data = PoolIntArray( -196609, 4, 0, -131073, 4, 0, -65537, 4, 0, -3, 4, 0, -2, 4, 0, -1, 4, 0, -65517, 4, 0, 65533, 4, 0, 19, 4, 65536, 131069, 4, 0, 65555, 4, 65536, 196605, 4, 0, 131073, 2, 1, 131074, 2, 2, 131091, 4, 65536, 262141, 4, 0, 262142, 4, 0, 262143, 4, 0, 196608, 4, 65536, 196609, 2, 65537, 196610, 2, 65538, 196627, 4, 65536, 262144, 4, 0, 262163, 4, 0, 327680, 4, 65536, 327699, 4, 65536, 393216, 4, 65536, 393235, 4, 65536, 458752, 4, 65536, 458771, 4, 65536, 589823, 0, 1, 524288, 4, 131072, 524289, 0, 3, 524290, 0, 1, 524291, 0, 2, 524292, 0, 3, 524293, 0, 1, 524294, 0, 2, 524295, 0, 3, 524296, 0, 1, 524297, 0, 2, 524298, 0, 3, 524299, 0, 1, 524300, 0, 2, 524301, 0, 3, 524302, 0, 1, 524303, 0, 2, 524304, 0, 3, 524305, 0, 1, 524306, 0, 2, 524307, 4, 0, 524308, 0, 1, 524309, 0, 2, 524310, 0, 3, 655359, 0, 65537, 589824, 0, 65538, 589825, 0, 65539, 589826, 0, 65537, 589827, 0, 65538, 589828, 0, 65539, 589829, 0, 65537, 589830, 0, 65538, 589831, 0, 65539, 589832, 0, 65537, 589833, 0, 65538, 589834, 0, 65539, 589835, 0, 65537, 589836, 0, 65538, 589837, 0, 65539, 589838, 0, 65537, 589839, 0, 65538, 589840, 0, 65539, 589841, 0, 65537, 589842, 0, 65538, 589843, 0, 65539, 589844, 0, 65537, 589845, 0, 65538, 589846, 0, 65539, 720895, 0, 131073, 655360, 0, 131074, 655361, 0, 131075, 655362, 0, 131073, 655363, 0, 131074, 655364, 0, 131075, 655365, 0, 131073, 655366, 0, 131074, 655367, 0, 131075, 655368, 0, 131073, 655369, 0, 131074, 655370, 0, 131075, 655371, 0, 131073, 655372, 0, 131074, 655373, 0, 131075, 655374, 0, 131073, 655375, 0, 131074, 655376, 0, 131075, 655377, 0, 131073, 655378, 0, 131074, 655379, 0, 131075, 655380, 0, 131073, 655381, 0, 131074, 655382, 0, 131075, 786431, 0, 196609, 720896, 0, 196610, 720897, 0, 196611, 720898, 0, 196609, 720899, 0, 196610, 720900, 0, 196611, 720901, 0, 196609, 720902, 0, 196610, 720903, 0, 196611, 720904, 0, 196609, 720905, 0, 196610, 720906, 0, 196611, 720907, 0, 196609, 720908, 0, 196610, 720909, 0, 196611, 720910, 0, 196609, 720911, 0, 196610, 720912, 0, 196611, 720913, 0, 196609, 720914, 0, 196610, 720915, 0, 196611, 720916, 0, 196609, 720917, 0, 196610, 720918, 0, 196611, 851967, 0, 262145, 786432, 0, 262146, 786433, 0, 262147, 786434, 0, 262145, 786435, 0, 262146, 786436, 0, 262147, 786437, 0, 262145, 786438, 0, 262146, 786439, 0, 262147, 786440, 0, 262145, 786441, 0, 262146, 786442, 0, 262147, 786443, 0, 262145, 786444, 0, 262146, 786445, 0, 262147, 786446, 0, 262145, 786447, 0, 262146, 786448, 0, 262147, 786449, 0, 262145, 786450, 0, 262146, 786451, 0, 262147, 786452, 0, 262145, 786453, 0, 262146, 786454, 0, 262147 ) +tile_data = PoolIntArray( -196609, 4, 0, -262125, 4, 65536, -131073, 4, 0, -196589, 4, 65536, -65537, 4, 0, -131053, 4, 65536, -3, 4, 0, -2, 4, 0, -1, 4, 0, -65517, 4, 0, -65516, 4, 65536, -65515, 4, 65536, -65514, 4, 65536, 65533, 4, 0, 22, 4, 65536, 131069, 4, 0, 65558, 4, 65536, 196605, 4, 0, 131073, 2, 1, 131074, 2, 2, 131089, 2, 0, 131090, 2, 1, 131094, 4, 65536, 262141, 4, 0, 262142, 4, 0, 262143, 4, 0, 196608, 4, 65536, 196609, 2, 65537, 196610, 2, 65538, 196625, 2, 65536, 196626, 2, 65537, 196627, 4, 65536, 196628, 4, 65536, 196629, 4, 65536, 196630, 4, 65536, 262144, 4, 0, 262163, 4, 0, 327680, 4, 65536, 327699, 4, 65536, 393216, 4, 65536, 393235, 4, 65536, 458752, 4, 65536, 458771, 4, 65536, 589823, 0, 1, 524288, 4, 131072, 524289, 0, 3, 524290, 0, 1, 524291, 0, 2, 524292, 0, 3, 524293, 0, 1, 524294, 0, 2, 524295, 0, 3, 524296, 0, 1, 524297, 0, 2, 524298, 0, 3, 524299, 0, 1, 524300, 0, 2, 524301, 0, 3, 524302, 0, 1, 524303, 0, 2, 524304, 0, 3, 524305, 0, 1, 524306, 0, 2, 524307, 4, 0, 524308, 0, 1, 524309, 0, 2, 524310, 0, 3, 655359, 0, 65537, 589824, 0, 65538, 589825, 0, 65539, 589826, 0, 65537, 589827, 0, 65538, 589828, 0, 65539, 589829, 0, 65537, 589830, 0, 65538, 589831, 0, 65539, 589832, 0, 65537, 589833, 0, 65538, 589834, 0, 65539, 589835, 0, 65537, 589836, 0, 65538, 589837, 0, 65539, 589838, 0, 65537, 589839, 0, 65538, 589840, 0, 65539, 589841, 0, 65537, 589842, 0, 65538, 589843, 0, 65539, 589844, 0, 65537, 589845, 0, 65538, 589846, 0, 65539, 720895, 0, 131073, 655360, 0, 131074, 655361, 0, 131075, 655362, 0, 131073, 655363, 0, 131074, 655364, 0, 131075, 655365, 0, 131073, 655366, 0, 131074, 655367, 0, 131075, 655368, 0, 131073, 655369, 0, 131074, 655370, 0, 131075, 655371, 0, 131073, 655372, 0, 131074, 655373, 0, 131075, 655374, 0, 131073, 655375, 0, 131074, 655376, 0, 131075, 655377, 0, 131073, 655378, 0, 131074, 655379, 0, 131075, 655380, 0, 131073, 655381, 0, 131074, 655382, 0, 131075, 786431, 0, 196609, 720896, 0, 196610, 720897, 0, 196611, 720898, 0, 196609, 720899, 0, 196610, 720900, 0, 196611, 720901, 0, 196609, 720902, 0, 196610, 720903, 0, 196611, 720904, 0, 196609, 720905, 0, 196610, 720906, 0, 196611, 720907, 0, 196609, 720908, 0, 196610, 720909, 0, 196611, 720910, 0, 196609, 720911, 0, 196610, 720912, 0, 196611, 720913, 0, 196609, 720914, 0, 196610, 720915, 0, 196611, 720916, 0, 196609, 720917, 0, 196610, 720918, 0, 196611, 851967, 0, 262145, 786432, 0, 262146, 786433, 0, 262147, 786434, 0, 262145, 786435, 0, 262146, 786436, 0, 262147, 786437, 0, 262145, 786438, 0, 262146, 786439, 0, 262147, 786440, 0, 262145, 786441, 0, 262146, 786442, 0, 262147, 786443, 0, 262145, 786444, 0, 262146, 786445, 0, 262147, 786446, 0, 262145, 786447, 0, 262146, 786448, 0, 262147, 786449, 0, 262145, 786450, 0, 262146, 786451, 0, 262147, 786452, 0, 262145, 786453, 0, 262146, 786454, 0, 262147 ) [node name="TileMap Foreground" parent="." index="2"] tile_set = ExtResource( 2 ) @@ -58,3 +63,20 @@ __meta__ = { [node name="Camera Bounds" parent="." index="7"] tile_data = PoolIntArray( -65536, 0, 0, -65521, 0, 0, 65535, 0, 0, 16, 0, 0, 524287, 0, 0, 458768, 0, 0, 589824, 0, 0, 589839, 0, 0 ) + +[node name="Modifier_Component" parent="." index="8" instance=ExtResource( 6 )] +position = Vector2( 248, 115 ) +modifier = ExtResource( 5 ) + +[node name="CollisionShape2D" type="CollisionShape2D" parent="Modifier_Component" index="0"] +shape = SubResource( 3 ) + +[node name="Label" type="Label" parent="." index="9"] +margin_left = 78.0 +margin_top = 9.0 +margin_right = 244.0 +margin_bottom = 25.0 +theme = ExtResource( 7 ) +text = "The floor is slippy" +align = 1 +valign = 1