25 lines
540 B
GDScript
25 lines
540 B
GDScript
@tool
|
|
extends Button
|
|
|
|
@export var locked: bool = true
|
|
@export var image: Texture:
|
|
set(value):
|
|
image = value
|
|
if is_inside_tree() and has_node("%Texture"):
|
|
$%Texture.texture = image
|
|
|
|
func _ready():
|
|
if image != null and has_node("%Texture"):
|
|
$%Texture.texture = image
|
|
if has_node("%TextureRect"):
|
|
if locked:
|
|
$%TextureRect.show()
|
|
else:
|
|
$%TextureRect.hide()
|
|
TweenFX.breathe(self, 1)
|
|
|
|
func _on_pressed() -> void:
|
|
if TweenFX.is_playing(self, TweenFX.Animations.PRESS_ROTATE):
|
|
return
|
|
TweenFX.press_rotate(self)
|