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/Button_Node2D.gd

37 lines
830 B
GDScript3
Raw Normal View History

2023-02-25 01:04:08 +01:00
extends Button
onready var villain = $"../Villain/AnimatedSprite"
2023-02-25 14:17:42 +01:00
var etat
2023-02-25 14:02:57 +01:00
var _texture1 = load("res://Assets//skin_assets/button_normal.png")
var _texture2 = load("res://Assets//skin_assets/button_pressed.png")
2023-02-25 01:04:08 +01:00
# Called when the node enters the scene tree for the first time.
func _ready():
2023-02-25 14:25:51 +01:00
etat = false
pass # Replace with function body.
2023-02-25 01:04:08 +01:00
# Called every frame. 'delta' is the elapsed time since the previous frame.
2023-02-25 14:02:57 +01:00
func _process(_delta):
2023-02-25 14:25:51 +01:00
match villain.get_frame():
2:
if etat:
print("non")
else:
print("caché")
_:
if etat:
print("oui")
else:
print("caché")
2023-02-25 01:04:08 +01:00
func _on_Button_pressed():
2023-02-25 14:25:51 +01:00
etat = !etat
if(etat) :
self.StyleBoxTexture.set_texture(_texture1) # reste appuyé
else :
self.StyleBoxTexture.set_texture(_texture2) # pas appuyé