extends Control @onready var image: TextureRect = $image @onready var label: Label = $image/Label ## ITEM TEXTURES #AMMO const LIGHT_AMMO = preload("res://assets/Textures/ObjectTextures/light_ammo.png") const MEDIUM_AMMO = preload("res://assets/Textures/ObjectTextures/medium_ammo.png") const HEAVY_AMMO = preload("res://assets/Textures/ObjectTextures/heavy_ammo.png") const SHOTGUN_AMMO = preload("res://assets/Textures/ObjectTextures/shotgun_ammo.png") const ROCKET = preload("res://assets/Textures/ObjectTextures/rocket.png") const MONEY = preload("res://assets/Textures/ObjectTextures/money.png") const HEALTH = preload("res://assets/Textures/ObjectTextures/health.png") const STAMINA = preload("res://assets/Textures/ObjectTextures/stamina.png") var pickup_type var ammo_type var value var random_point var alpha_amt : float = 1.0 # Called when the node enters the scene tree for the first time. func _ready() -> void: random_point = get_random_point() match pickup_type: 0: match ammo_type: 0: image.texture = LIGHT_AMMO 1: image.texture = MEDIUM_AMMO #medium 2: image.texture = HEAVY_AMMO #heavy 3: image.texture = SHOTGUN_AMMO #shotgun 4: image.texture = ROCKET 1: image.texture = STAMINA 2: image.texture = HEALTH 3: image.texture = MONEY if pickup_type == 3: label.text = str("$",value) else: label.text = str(value) # Called every frame. 'delta' is the elapsed time since the previous frame. func _process(delta: float) -> void: alpha_amt = lerp(alpha_amt, 0.0,delta * 1.5) modulate = Color(1, 1, 1, alpha_amt) position += random_point * delta * 1.5 scale = lerp(scale,Vector2(0,0), delta * .5) if alpha_amt <= .01: queue_free() func get_random_point(): var x_pos = randf_range(-50,50) var y_pos = randf_range(-250,-300) return Vector2(x_pos,y_pos)