37 lines
676 B
GDScript
37 lines
676 B
GDScript
extends Button
|
|
|
|
class_name Photo
|
|
|
|
@onready var texture_rect: TextureRect = $%PhotoTexture
|
|
|
|
func setup(texture: Texture) -> void:
|
|
if texture:
|
|
if !texture_rect:
|
|
texture_rect = $%PhotoTexture
|
|
texture_rect.texture = texture
|
|
|
|
|
|
func _on_pressed() -> void:
|
|
TweenFX.stop_all(self)
|
|
scale = Vector2.ONE
|
|
rotation = 0.0
|
|
modulate.a = 1.0
|
|
TweenFX.punch_in(self)
|
|
GameState.on_photo_highlighted.emit(texture_rect.texture)
|
|
|
|
|
|
|
|
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
|