stylebox now works!
This commit is contained in:
parent
55767a4bd9
commit
87d8a5ff16
1 changed files with 9 additions and 8 deletions
|
@ -2,8 +2,8 @@ extends Button
|
||||||
|
|
||||||
onready var villain = $"../Villain/AnimatedSprite"
|
onready var villain = $"../Villain/AnimatedSprite"
|
||||||
var etat
|
var etat
|
||||||
var _texture1 = load("res://Assets//skin_assets/button_normal.png")
|
var texture_pressed = preload("res://Assets/skin_assets/button_normal.png")
|
||||||
var _texture2 = load("res://Assets//skin_assets/button_pressed.png")
|
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.
|
||||||
|
@ -28,9 +28,10 @@ func _process(_delta):
|
||||||
|
|
||||||
|
|
||||||
func _on_Button_pressed():
|
func _on_Button_pressed():
|
||||||
etat = !etat
|
etat = !etat
|
||||||
|
var new_stylebox_normal = self.get_stylebox("normal").duplicate()
|
||||||
if(etat) :
|
if etat:
|
||||||
self.StyleBoxTexture.set_texture(_texture1) # reste appuyé
|
new_stylebox_normal.texture = texture_pressed
|
||||||
else :
|
else:
|
||||||
self.StyleBoxTexture.set_texture(_texture2) # pas appuyé
|
new_stylebox_normal.texture = texture_released
|
||||||
|
self.add_stylebox_override("normal", new_stylebox_normal)
|
||||||
|
|
Reference in a new issue