 824295f63c
			
		
	
	824295f63c
	
	
	
		
			
			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.
		
			
				
	
	
		
			26 lines
		
	
	
		
			781 B
		
	
	
	
		
			GDScript
		
	
	
	
	
	
			
		
		
	
	
			26 lines
		
	
	
		
			781 B
		
	
	
	
		
			GDScript
		
	
	
	
	
	
| class_name NormalCheese extends Area2D
 | |
| 
 | |
| 
 | |
| @onready var animation_player := $AnimationPlayer as AnimationPlayer
 | |
| @onready var timer := $Timer as Timer
 | |
| @export var CHEESE_RESPAWN_TIME : int = 1
 | |
| var picked :bool = false
 | |
| 
 | |
| func _on_body_entered(body: Node2D) -> void:
 | |
|     if not picked:
 | |
|         animation_player.play(&"picked")
 | |
|         (body as Princess).you_got_cheese()
 | |
|         picked = true
 | |
|         # Le fromage peut être à utilisation unique
 | |
|         if CHEESE_RESPAWN_TIME > 0:
 | |
|             timer.start(CHEESE_RESPAWN_TIME)
 | |
| 
 | |
| func _on_timer_timeout() -> void:
 | |
|     timer.stop()
 | |
|     animation_player.play(&"RESET")
 | |
| 
 | |
| func _on_animation_player_animation_finished(anim_name: StringName) -> void:
 | |
|     if anim_name == "RESET":
 | |
|         animation_player.play(&"cheese")
 | |
|         picked = false
 |