16 lines
369 B
GDScript
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")
|