Rename long function name

This commit is contained in:
2024-03-29 18:49:36 -07:00
parent c8dcff8c05
commit 571231eeb7

View File

@ -19,7 +19,7 @@ var status = {
var current_tool = "none" 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 return status.level*10
func change_tool(tool): func change_tool(tool):
@ -37,7 +37,7 @@ func _physics_process(delta):
velocity = lerp(velocity, pre_velocity * speed, accel*delta) velocity = lerp(velocity, pre_velocity * speed, accel*delta)
move_and_slide() move_and_slide()
func _process(delta): func _process(_delta):
if Input.is_action_pressed("game_interact"): if Input.is_action_pressed("game_interact"):
if !$animation.is_playing(): if !$animation.is_playing():
$animation.play("hit") $animation.play("hit")
@ -51,25 +51,24 @@ func _process(delta):
# Update inventory HUD # Update inventory HUD
$hud/inventory/stone_label.text = str(inventory.stone) $hud/inventory/stone_label.text = str(inventory.stone)
$hud/inventory/wood_label.text = str(inventory.wood) $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 $hud/level/level_bar.value = inventory.points
# Update status HUD # Update status HUD
$hud/bars/health.value = status.health $hud/bars/health.value = status.health
$hud/bars/stamina.value = status.stamina $hud/bars/stamina.value = status.stamina
$hud/level/level.text = "Level " + str(status.level) $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 # Level up
if inventory.points >= (get_total_points_for_next_level()): if inventory.points >= (next_level_points()):
inventory.points -= get_total_points_for_next_level() inventory.points -= next_level_points()
status.level += 1 status.level += 1
level_up() level_up()
func level_up(): func level_up():
if status.level in game_data.level_tools: pass
change_tool(game_data.level_tools[status.level])
func _input(event): func _input(event):
if event is InputEventMouseMotion: if event is InputEventMouseMotion: