31 lines
646 B
GDScript
31 lines
646 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:
|
|
if TweenFX.is_playing(self, TweenFX.Animations.PUNCH_IN):
|
|
return
|
|
TweenFX.punch_in(self)
|
|
GameState.on_photo_highlighted.emit(texture_rect.texture)
|
|
|
|
|
|
|
|
func _on_mouse_entered() -> void:
|
|
if TweenFX.is_playing(self, TweenFX.Animations.BREATHE):
|
|
return
|
|
TweenFX.breathe(self, 1)
|
|
|
|
|
|
func _on_mouse_exited() -> void:
|
|
TweenFX.stop(self, TweenFX.Animations.BREATHE)
|
|
scale = Vector2(1, 1)
|