46 lines
854 B
GDScript
46 lines
854 B
GDScript
@tool
|
|
extends Button
|
|
|
|
class_name ArrowButton
|
|
|
|
@export var image: Texture:
|
|
set(value):
|
|
image = value
|
|
if is_inside_tree() and has_node("%Texture"):
|
|
$%Texture.texture = image
|
|
|
|
@export var flip_h: bool = false:
|
|
set(value):
|
|
flip_h = value
|
|
if is_inside_tree() and has_node("%Texture"):
|
|
if $%Texture != null:
|
|
$%Texture.flip_h = flip_h
|
|
|
|
func _ready():
|
|
if image != null and has_node("%Texture"):
|
|
$%Texture.texture = image
|
|
$%Texture.flip_h = flip_h
|
|
|
|
|
|
func _on_pressed() -> void:
|
|
TweenFX.stop_all(self)
|
|
scale = Vector2.ONE
|
|
rotation = 0.0
|
|
modulate.a = 1.0
|
|
TweenFX.punch_in(self)
|
|
|
|
|
|
func _on_mouse_entered() -> void:
|
|
TweenFX.stop_all(self)
|
|
scale = Vector2.ONE
|
|
rotation = 0.0
|
|
modulate.a = 1.0
|
|
TweenFX.breathe(self, 1)
|
|
|
|
|
|
func _on_mouse_exited() -> void:
|
|
TweenFX.stop_all(self)
|
|
scale = Vector2.ONE
|
|
rotation = 0.0
|
|
modulate.a = 1.0
|