[agent:claude-cli] feat(boost): turbo boost avec énergie/cooldown, barre HUD dynamique, speed lines overlay et son distinct au déclenchement
This commit is contained in:
@@ -19,6 +19,13 @@ signal echolocation_triggered(position: Vector3, radius: float)
|
||||
signal stats_changed(oxygen: float, health: float, hunger: float)
|
||||
signal player_died()
|
||||
signal use_consumable_requested()
|
||||
signal boost_changed(energy: float, max_energy: float, is_active: bool)
|
||||
|
||||
# --- Boost parameters ---
|
||||
@export var boost_max_energy: float = 100.0
|
||||
@export var boost_drain_rate: float = 40.0 # energy/s while boosting
|
||||
@export var boost_regen_rate: float = 20.0 # energy/s when not boosting
|
||||
@export var boost_min_energy_to_start: float = 15.0 # minimum to engage boost
|
||||
|
||||
# --- Internal State ---
|
||||
var oxygen: float
|
||||
@@ -26,6 +33,7 @@ var health: float
|
||||
var hunger: float
|
||||
var is_boosting: bool = false
|
||||
var is_echolocating: bool = false
|
||||
var boost_energy: float = 100.0
|
||||
|
||||
var _yaw: float = 0.0
|
||||
var _pitch: float = 0.0
|
||||
@@ -47,6 +55,7 @@ func _ready() -> void:
|
||||
oxygen = max_oxygen
|
||||
health = max_health
|
||||
hunger = max_hunger
|
||||
boost_energy = boost_max_energy
|
||||
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
|
||||
_setup_input_actions()
|
||||
_emit_stats()
|
||||
@@ -125,7 +134,25 @@ func _physics_process(delta: float) -> void:
|
||||
|
||||
|
||||
func _update_movement(delta: float) -> void:
|
||||
is_boosting = Input.is_action_pressed("boost")
|
||||
var wants_boost: bool = Input.is_action_pressed("boost")
|
||||
# Only boost if we have energy and enough to start
|
||||
if wants_boost and boost_energy >= boost_min_energy_to_start:
|
||||
is_boosting = true
|
||||
elif wants_boost and is_boosting and boost_energy > 0.0:
|
||||
is_boosting = true # keep boosting until empty
|
||||
else:
|
||||
is_boosting = false
|
||||
|
||||
# Update boost energy
|
||||
if is_boosting:
|
||||
boost_energy = max(0.0, boost_energy - boost_drain_rate * delta)
|
||||
if boost_energy <= 0.0:
|
||||
is_boosting = false
|
||||
else:
|
||||
boost_energy = min(boost_max_energy, boost_energy + boost_regen_rate * delta)
|
||||
|
||||
boost_changed.emit(boost_energy, boost_max_energy, is_boosting)
|
||||
|
||||
var speed: float = swim_speed * (boost_multiplier if is_boosting else 1.0)
|
||||
|
||||
# forward/right using camera pitch for intuitive swim direction
|
||||
|
||||
Reference in New Issue
Block a user