From 571231eeb78ba808af602314dc7a769714a302fb Mon Sep 17 00:00:00 2001 From: Zakarya Date: Fri, 29 Mar 2024 18:49:36 -0700 Subject: [PATCH] Rename long function name --- data/character/character.gd | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/data/character/character.gd b/data/character/character.gd index d99dd04..5b07fa8 100644 --- a/data/character/character.gd +++ b/data/character/character.gd @@ -19,7 +19,7 @@ var status = { var current_tool = "none" -func get_total_points_for_next_level(): # Yes, this name is very long. Deal with it +func next_level_points(): return status.level*10 func change_tool(tool): @@ -37,7 +37,7 @@ func _physics_process(delta): velocity = lerp(velocity, pre_velocity * speed, accel*delta) move_and_slide() -func _process(delta): +func _process(_delta): if Input.is_action_pressed("game_interact"): if !$animation.is_playing(): $animation.play("hit") @@ -51,25 +51,24 @@ func _process(delta): # Update inventory HUD $hud/inventory/stone_label.text = str(inventory.stone) $hud/inventory/wood_label.text = str(inventory.wood) - $hud/level/points.text = str(inventory.points) + "/" + str(get_total_points_for_next_level()) + $hud/level/points.text = str(inventory.points) + "/" + str(next_level_points()) $hud/level/level_bar.value = inventory.points # Update status HUD $hud/bars/health.value = status.health $hud/bars/stamina.value = status.stamina $hud/level/level.text = "Level " + str(status.level) - $hud/level/level_bar.max_value = get_total_points_for_next_level() + $hud/level/level_bar.max_value = next_level_points() # Level up - if inventory.points >= (get_total_points_for_next_level()): - inventory.points -= get_total_points_for_next_level() + if inventory.points >= (next_level_points()): + inventory.points -= next_level_points() status.level += 1 level_up() func level_up(): - if status.level in game_data.level_tools: - change_tool(game_data.level_tools[status.level]) + pass func _input(event): if event is InputEventMouseMotion: