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.
|
# Called when the node enters the scene tree for the first time.
|
||||||
func _ready():
|
func _ready():
|
||||||
timer = 0
|
timer = 0
|
||||||
rng.randomize()
|
rng.randomize()
|
||||||
limit_random = rng.randi_range(2, 10)
|
limit_random = rng.randi_range(2, 10)
|
||||||
|
|
||||||
|
|
||||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
func _process(delta):
|
func _process(delta):
|
||||||
timer += delta
|
timer += delta
|
||||||
match me.get_frame():
|
match me.get_frame():
|
||||||
0:
|
0:
|
||||||
# Vert
|
# Vert
|
||||||
if timer >= limit_random:
|
if timer >= limit_random:
|
||||||
timer = 0
|
timer = 0
|
||||||
limit_random = rng.randi_range(2, 10)
|
limit_random = rng.randi_range(2, 10)
|
||||||
me.set_frame(1)
|
me.set_frame(1)
|
||||||
1:
|
1:
|
||||||
# Orange
|
# Orange
|
||||||
if timer >= .5:
|
if timer >= .5:
|
||||||
timer = 0
|
timer = 0
|
||||||
me.set_frame(2)
|
me.set_frame(2)
|
||||||
2:
|
2:
|
||||||
# Rouge
|
# Rouge
|
||||||
if timer >= 2:
|
if timer >= 2:
|
||||||
timer = 0
|
timer = 0
|
||||||
me.set_frame(0)
|
me.set_frame(0)
|
||||||
_:
|
_:
|
||||||
print("Not handled frame")
|
print("Not handled frame")
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
extends Button
|
extends Button
|
||||||
|
|
||||||
onready var villain = $"../Villain/AnimatedSprite"
|
onready var villain = $"../Villain/AnimatedSprite"
|
||||||
|
|
||||||
var etat
|
var etat
|
||||||
var texture_pressed = preload("res://Assets/skin_assets/button_normal.png")
|
var texture_pressed = preload("res://Assets/skin_assets/button_normal.png")
|
||||||
var texture_released = preload("res://Assets/skin_assets/button_pressed.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.
|
# Called when the node enters the scene tree for the first time.
|
||||||
func _ready():
|
func _ready():
|
||||||
etat = false
|
etat = false
|
||||||
pass # Replace with function body.
|
pass # Replace with function body.
|
||||||
|
|
||||||
|
|
||||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
func _process(_delta):
|
func _process(_delta):
|
||||||
match villain.get_frame():
|
match villain.get_frame():
|
||||||
2:
|
2:
|
||||||
if etat:
|
if etat:
|
||||||
print("non")
|
print("non")
|
||||||
else:
|
else:
|
||||||
print("caché")
|
print("caché")
|
||||||
_:
|
_:
|
||||||
if etat:
|
if etat:
|
||||||
print("oui")
|
print("oui")
|
||||||
else:
|
else:
|
||||||
print("caché")
|
print("caché")
|
||||||
|
|
||||||
|
|
||||||
func _on_Button_pressed():
|
func _on_Button_pressed():
|
||||||
|
|
|
@ -3,7 +3,7 @@ extends Control
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
# Called when the node enters the scene tree for the first time.
|
||||||
func _ready():
|
func _ready():
|
||||||
pass # Replace with function body.
|
pass # Replace with function body.
|
||||||
|
|
||||||
|
|
||||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
|
@ -12,14 +12,14 @@ func _ready():
|
||||||
|
|
||||||
|
|
||||||
func _on_PlayButton_pressed():
|
func _on_PlayButton_pressed():
|
||||||
print("ici")
|
print("ici")
|
||||||
get_tree().change_scene("res://Scenes/Node2D.tscn")
|
get_tree().change_scene("res://Scenes/Node2D.tscn")
|
||||||
|
|
||||||
|
|
||||||
func _on_Help_Button_pressed():
|
func _on_Help_Button_pressed():
|
||||||
print("help")
|
print("help")
|
||||||
|
|
||||||
|
|
||||||
func _on_Quit_Button_pressed():
|
func _on_Quit_Button_pressed():
|
||||||
get_tree().quit()
|
get_tree().quit()
|
||||||
# Replace with function body.
|
# Replace with function body.
|
||||||
|
|
Reference in a new issue