From df154a786c753faf40f9daf0f5d2d55ebcbb34f7 Mon Sep 17 00:00:00 2001 From: Gabriel Kaszewski Date: Thu, 29 May 2025 01:33:54 +0200 Subject: [PATCH] Add minimum jump height, fire rate configuration, and improve throw input handling --- objects/entities/brick_player.tscn | 1 + resources/skills/brick_throw.tres | 1 + scripts/components/brick_throw.gd | 3 +++ scripts/resources/tap_throw_input_resource.gd | 4 ++-- scripts/ui/main_menu.gd | 2 ++ 5 files changed, 9 insertions(+), 2 deletions(-) diff --git a/objects/entities/brick_player.tscn b/objects/entities/brick_player.tscn index 25b5736..706e1a8 100644 --- a/objects/entities/brick_player.tscn +++ b/objects/entities/brick_player.tscn @@ -284,6 +284,7 @@ script = ExtResource("38_o1ihh") health_component = NodePath("../HealthComponent") sprite = NodePath("../Graphics/Root/Base") platform_movement = NodePath("../Movements/PlatformMovement") +min_jump_height = 100.0 jump_reduction_percentage = 0.15 [connection signal="on_death" from="HealthComponent" to="PlayerDeathComponent" method="_on_health_component_on_death"] diff --git a/resources/skills/brick_throw.tres b/resources/skills/brick_throw.tres index a3f7f2f..6c593eb 100644 --- a/resources/skills/brick_throw.tres +++ b/resources/skills/brick_throw.tres @@ -11,6 +11,7 @@ name = "BRICK_POWER" description = "BRICK_POWER_DESCRIPTION" node = ExtResource("1_5gnea") config = { +"fire_rate": 0.6, "player_controller": NodePath("."), "throw_input_behavior": ExtResource("1_xwijh"), "timer": NodePath("ThrowTimer") diff --git a/scripts/components/brick_throw.gd b/scripts/components/brick_throw.gd index ddeebbf..deaca8f 100644 --- a/scripts/components/brick_throw.gd +++ b/scripts/components/brick_throw.gd @@ -40,6 +40,9 @@ func on_timer_timeout() -> void: func throw_brick(power_multiplier: float = 1.0) -> void: + if not can_throw: + return + var instance: Node2D = brick_scene.instantiate() var init := instance.get_node_or_null("ProjectileInitComponent") as ProjectileInitComponent if init and player_controller.current_movement is PlatformMovement: diff --git a/scripts/resources/tap_throw_input_resource.gd b/scripts/resources/tap_throw_input_resource.gd index 188e8f9..967229f 100644 --- a/scripts/resources/tap_throw_input_resource.gd +++ b/scripts/resources/tap_throw_input_resource.gd @@ -1,6 +1,6 @@ class_name TapThrowInputResource extends ThrowInputResource -func process_input(event: InputEvent) -> void: - if event.is_action_pressed("attack"): +func update(_delta: float) -> void: + if Input.is_action_pressed("attack"): throw_requested.emit(1.0) \ No newline at end of file diff --git a/scripts/ui/main_menu.gd b/scripts/ui/main_menu.gd index 4d73087..cd9975b 100644 --- a/scripts/ui/main_menu.gd +++ b/scripts/ui/main_menu.gd @@ -32,6 +32,8 @@ func _ready() -> void: else: continue_button.disabled = false + continue_button.grab_focus() + func _on_new_game_button_pressed() -> void: if gm: