pickup item values are assigned through level editor and spawn correctly, now need to implement non random spawns

This commit is contained in:
Derek
2025-01-16 23:09:57 -06:00
parent 0a3bdd26d4
commit cafcf57ef1
7 changed files with 53 additions and 28 deletions

View File

@@ -13,6 +13,7 @@ extends Node3D
@export var health_drop_enabled = true
@export var money_drop_enabled = true
@onready var item_pickup = preload("res://assets/item_pickup.tscn")
@onready var crown = preload("res://assets/crown.tscn")
var ammo_drop = [[load("res://assets/ammo_pickup.tscn")],["ammo"]]
var stamina_drop = [[load("res://assets/stamina_pickup.tscn")],["stamina"]]
@@ -185,13 +186,17 @@ func die():
player.health_indicator.color = Color(0.471, 0, 0, 0)
func pickup_spawn():
var item_type = pickups.pick_random()
var item_spawn = item_type[0][0].instantiate()
#var item_name = item_type[1][0]
item_spawn.rand_amt = randi_range(25,100)
return item_spawn
##SET VARIABLES
var type = randi_range(0,3)
var ammo_type
var value
if type == 0:
ammo_type = randi_range(0,4)
value = randi_range(1,10)
return {"pickup_type" : type,"ammo_type" : ammo_type,"value" : value}
func save_quit():
SaveLoad.save_game_data(level_name)