Añadidos drops, ahora cae cerveza o cafe
This commit is contained in:
1 parent
bbecc76dbe
commit
8bbf70e8cb
11 files changed
+282
-1
No files matched your search
+34
-1
@@ -198,6 +198,10 @@ var is_dead: bool = false
|
||||
|
||||
var jumps_remaining: int = 2
|
||||
|
||||
var _speed_boost_timer: float = 0.0
|
||||
var _speed_boost_multiplier: float = 1.0
|
||||
var _original_move_speed: float = 0.0
|
||||
|
||||
# Tracks the highest point reached since leaving the ground, used to scale
|
||||
# ground pound damage by jump height instead of fall distance.
|
||||
var _jump_height_tracking: bool = false
|
||||
@@ -220,6 +224,7 @@ func _ready() -> void:
|
||||
if character_data.sprite_frames != null:
|
||||
animated_sprite.sprite_frames = character_data.sprite_frames
|
||||
|
||||
_original_move_speed = character_data.move_speed
|
||||
jumps_remaining = max_jumps
|
||||
|
||||
_setup_attack_hitboxes()
|
||||
@@ -227,6 +232,7 @@ func _ready() -> void:
|
||||
_update_animation()
|
||||
health_changed.emit(current_health, character_data.max_health)
|
||||
special_charge_changed.emit(special_charge, special_max_charge)
|
||||
_connect_pickups()
|
||||
# Conecta a los enemigos que ya estén en el árbol. Si se añaden más tarde,
|
||||
# se conectarán cuando mueran mediante el grupo "enemy".
|
||||
_connect_to_enemies()
|
||||
@@ -245,6 +251,7 @@ func _physics_process(delta: float) -> void:
|
||||
_apply_gravity(delta)
|
||||
_handle_horizontal_movement(delta)
|
||||
_update_punch_damage()
|
||||
_update_speed_boost(delta)
|
||||
|
||||
move_and_slide()
|
||||
|
||||
@@ -281,7 +288,10 @@ func _handle_horizontal_movement(delta: float) -> void:
|
||||
facing_direction = signf(direction)
|
||||
_update_facing()
|
||||
|
||||
var target_speed: float = direction * character_data.move_speed
|
||||
var move_speed: float = character_data.move_speed
|
||||
if _speed_boost_timer > 0.0:
|
||||
move_speed *= (1.0 + _speed_boost_multiplier)
|
||||
var target_speed: float = direction * move_speed
|
||||
|
||||
if ground_pound_active:
|
||||
target_speed *= ground_pound_horizontal_control
|
||||
@@ -508,6 +518,27 @@ func _apply_special_attack(charge_used: int = special_max_charge) -> void:
|
||||
enemy.take_damage(damage, global_position)
|
||||
|
||||
|
||||
func _connect_pickups() -> void:
|
||||
for pickup in get_tree().get_nodes_in_group("pickup"):
|
||||
if is_instance_valid(pickup) and pickup.has_signal(&"picked_up"):
|
||||
pickup.picked_up.connect(_on_pickup_picked_up)
|
||||
|
||||
|
||||
func _on_pickup_picked_up(pickup: Node, data: PickupData) -> void:
|
||||
if is_dead or data == null:
|
||||
return
|
||||
if data.effect_type == "heal":
|
||||
current_health = min(current_health + int(data.value), character_data.max_health)
|
||||
health_changed.emit(current_health, character_data.max_health)
|
||||
elif data.effect_type == "speed_boost":
|
||||
_speed_boost_multiplier = data.value
|
||||
_speed_boost_timer = data.duration
|
||||
|
||||
|
||||
func _update_speed_boost(_delta: float) -> void:
|
||||
pass
|
||||
|
||||
|
||||
func _connect_to_enemies() -> void:
|
||||
for enemy in get_tree().get_nodes_in_group("enemy"):
|
||||
if is_instance_valid(enemy) and enemy.has_signal(&"died"):
|
||||
@@ -589,6 +620,8 @@ func _update_timers(delta: float) -> void:
|
||||
attack_cooldown_timer = max(attack_cooldown_timer - delta, 0.0)
|
||||
ground_pound_debug_timer = max(ground_pound_debug_timer - delta, 0.0)
|
||||
invulnerability_timer = max(invulnerability_timer - delta, 0.0)
|
||||
if _speed_boost_timer > 0.0:
|
||||
_speed_boost_timer = max(_speed_boost_timer - delta, 0.0)
|
||||
|
||||
|
||||
func _update_animation() -> void:
|
||||
|
||||
Reference in new issue
Block a user