diff --git a/Characters/Villain.gd b/Characters/Villain.gd index 2e3a94b..35a4022 100755 --- a/Characters/Villain.gd +++ b/Characters/Villain.gd @@ -10,30 +10,30 @@ onready var button = $"../Button/" # Called when the node enters the scene tree for the first time. func _ready(): - timer = 0 - rng.randomize() - limit_random = rng.randi_range(2, 10) + timer = 0 + rng.randomize() + limit_random = rng.randi_range(2, 10) # Called every frame. 'delta' is the elapsed time since the previous frame. func _process(delta): - timer += delta - match me.get_frame(): - 0: - # Vert - if timer >= limit_random: - timer = 0 - limit_random = rng.randi_range(2, 10) - me.set_frame(1) - 1: - # Orange - if timer >= .5: - timer = 0 - me.set_frame(2) - 2: - # Rouge - if timer >= 2: - timer = 0 - me.set_frame(0) - _: - print("Not handled frame") + timer += delta + match me.get_frame(): + 0: + # Vert + if timer >= limit_random: + timer = 0 + limit_random = rng.randi_range(2, 10) + me.set_frame(1) + 1: + # Orange + if timer >= .5: + timer = 0 + me.set_frame(2) + 2: + # Rouge + if timer >= 2: + timer = 0 + me.set_frame(0) + _: + print("Not handled frame") diff --git a/Scenes/Button_Node2D.gd b/Scenes/Button_Node2D.gd index 9715d84..4c56265 100755 --- a/Scenes/Button_Node2D.gd +++ b/Scenes/Button_Node2D.gd @@ -1,6 +1,7 @@ extends Button onready var villain = $"../Villain/AnimatedSprite" + var etat var texture_pressed = preload("res://Assets/skin_assets/button_normal.png") var texture_released = preload("res://Assets/skin_assets/button_pressed.png") @@ -8,23 +9,23 @@ var texture_released = preload("res://Assets/skin_assets/button_pressed.png") # Called when the node enters the scene tree for the first time. func _ready(): - etat = false - pass # Replace with function body. + etat = false + pass # Replace with function body. # Called every frame. 'delta' is the elapsed time since the previous frame. func _process(_delta): - match villain.get_frame(): - 2: - if etat: - print("non") - else: - print("caché") - _: - if etat: - print("oui") - else: - print("caché") + match villain.get_frame(): + 2: + if etat: + print("non") + else: + print("caché") + _: + if etat: + print("oui") + else: + print("caché") func _on_Button_pressed(): diff --git a/Scenes/Screen_Menu.gd b/Scenes/Screen_Menu.gd index 916d701..7513b43 100755 --- a/Scenes/Screen_Menu.gd +++ b/Scenes/Screen_Menu.gd @@ -3,7 +3,7 @@ extends Control # Called when the node enters the scene tree for the first time. func _ready(): - pass # Replace with function body. + pass # Replace with function body. # Called every frame. 'delta' is the elapsed time since the previous frame. @@ -12,14 +12,14 @@ func _ready(): func _on_PlayButton_pressed(): - print("ici") - get_tree().change_scene("res://Scenes/Node2D.tscn") + print("ici") + get_tree().change_scene("res://Scenes/Node2D.tscn") func _on_Help_Button_pressed(): - print("help") + print("help") func _on_Quit_Button_pressed(): - get_tree().quit() - # Replace with function body. + get_tree().quit() +# Replace with function body.