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"
|
||||
var etat
|
||||
var _texture1 = load("res://Assets//skin_assets/button_normal.png")
|
||||
var _texture2 = load("res://Assets//skin_assets/button_pressed.png")
|
||||
var texture_pressed = preload("res://Assets/skin_assets/button_normal.png")
|
||||
var texture_released = preload("res://Assets/skin_assets/button_pressed.png")
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
|
@ -29,8 +29,9 @@ func _process(_delta):
|
|||
|
||||
func _on_Button_pressed():
|
||||
etat = !etat
|
||||
|
||||
if(etat) :
|
||||
self.StyleBoxTexture.set_texture(_texture1) # reste appuyé
|
||||
else :
|
||||
self.StyleBoxTexture.set_texture(_texture2) # pas appuyé
|
||||
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)
|
||||
|
|
Reference in a new issue