jeu/HUD: début de HUD pour les prouts

Maintenant 3 geauges de prout sont présentes et permettent au joueur de
savoir si il a du pet de dispo ou pas. Le joueur peut accumuler jusqu'à
trois prouts. Le temps de recharge est de 3 secondes par prout. C'est
peut être trop long.

Il faudra probablement bouger du code que j'ai mis dans game au dans le
code de niveau. Mais bon j'y réfléchirai le prochain coup.
This commit is contained in:
Thomas Lavocat
2023-05-10 23:03:14 +02:00
parent 3c6d18f746
commit 824295f63c
10 changed files with 248 additions and 20 deletions

35
HUD/fart_gauge.gd Normal file
View File

@@ -0,0 +1,35 @@
class_name FartGauge extends Node2D
@onready var animationPlayer := $AnimationPlayer as AnimationPlayer
signal reload_done()
signal dash_done()
var loading = false
var loaded = false
func load_cheese() -> bool:
if not loading and not loaded:
animationPlayer.play("reload")
loading = true
return true
return false
func dash_fart() -> bool:
if loaded:
animationPlayer.play("DASH")
return loaded
func reset():
animationPlayer.play("RESET")
loaded = false
func _on_animation_player_animation_finished(anim_name: StringName) -> void:
if anim_name == "reload":
loading = false
loaded = true
reload_done.emit()
if anim_name == "DASH":
loaded = false
dash_done.emit()