This repository has been archived on 2023-02-28. You can view files and clone it, but cannot push or open issues or pull requests.
Boups/Scenes/Scripts/Button_Node2D.gd
Mylloon 8f920f93b9
* Add cursors, background and new buttons
* Start implementation of desktop
2023-02-26 13:12:38 +01:00

25 lines
825 B
GDScript
Executable file

extends Button
onready var villain = $"../Villain/AnimatedSprite"
onready var villain_animations = $"../Villain".animations
var etat = false
const texture_pressed = preload("res://Assets/tres_button/hover-pressed.png")
const texture_released = preload("res://Assets/tres_button/normal.png")
# Called every frame. '_delta' is the elapsed time since the previous frame.
func _process(_delta) -> void:
if etat:
if villain.animation == villain_animations[-1]:
assert(get_tree().change_scene("res://Scenes/GameOver.tscn") == OK)
func _on_Button_pressed() -> void:
etat = !etat
var new_stylebox_normal = self.get_stylebox("normal").duplicate()
if etat:
new_stylebox_normal.texture = texture_pressed
else:
new_stylebox_normal.texture = texture_released
self.add_stylebox_override("normal", new_stylebox_normal)