ajout d'une animation de recharge et réparation du crash au chargement de chunk

This commit is contained in:
2026-01-16 12:28:36 +01:00
parent 74d2d0de3a
commit ff4feacea3
25 changed files with 431 additions and 236 deletions

View File

@@ -12,20 +12,16 @@ func _ready():
planet_update(GameInfo.game_data.current_planet_data, false)
player_update(GameInfo.game_data.player_data, false)
inventory_update(GameInfo.game_data.player_data.inventory)
%EnergyInfo.update_minimum_size()
func _on_player_updated(player_data : PlayerData):
player_update(player_data)
func player_update(player_data : PlayerData, with_animation = true):
var energy_count_text = "[b]%d[/b] / %d" % [player_data.energy, player_data.max_energy]
if energy_count_text != %EnergyCount.text and with_animation:
%EnergyAnimationPlayer.bounce()
%EnergyCount.text = energy_count_text
%EnergyInfo.modulate = Color.WHITE if player_data.energy > 0 else Color.RED
%EnergyInfo.update(
player_data.energy,
player_data.max_energy,
with_animation
)
func _on_inventory_updated(inventory : Inventory):
inventory_update(inventory)
@@ -97,11 +93,8 @@ func _on_player_action_tried_without_energy():
func _on_player_upgraded():
$EffectAnimation.play("upgrade")
func _on_planet_pass_day_started(planet):
$PassDayAnimation.speed_scale = 1/(planet.PASS_DAY_ANIMATION_TIME)
$PassDayAnimation.play("pass_day")
await $PassDayAnimation.animation_finished
$PassDayAnimation.speed_scale = 1
func _on_planet_pass_day_started(_planet):
%PassDay.pass_day_animation()
func _on_planet_pass_day_ended(planet:Planet):
if planet.data.charges == 1: