update format, following gdscript format guide
This commit is contained in:
parent
38877673b5
commit
b7a8dfaa76
3 changed files with 43 additions and 42 deletions
|
@ -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")
|
||||
|
|
|
@ -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():
|
||||
|
|
|
@ -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.
|
||||
|
|
Reference in a new issue