seeding-planets/entities/interactables/item_object/script/item_object_sprite.gd
2025-09-19 13:30:05 +02:00

16 lines
369 B
GDScript

extends Node2D
class_name ItemObjectSprite
@onready var iconSprite = $Icon
func apply_texture_to_sprite(texture, item_sprite_size = 50.):
if texture:
iconSprite.texture = texture
iconSprite.scale = Vector2(
1./(texture.get_width()/item_sprite_size),
1./(texture.get_height()/item_sprite_size)
)
func pickup_animation():
%AnimationPlayer.play("pickup")