add iron and forge

This commit is contained in:
2026-04-22 23:09:14 +03:00
parent 9066eecf1e
commit 297233c48e
10 changed files with 264 additions and 1 deletions
+11 -1
View File
@@ -3,6 +3,7 @@ extends CharacterBody3D
const PICKUP_SCENE := preload("res://scenes/Pickup.tscn")
const LEATHER_SCENE := preload("res://scenes/Leather.tscn")
const IRON_SCENE := preload("res://scenes/Iron.tscn")
signal died(points: int)
signal merged(upgrade: bool)
@@ -10,6 +11,7 @@ signal merged(upgrade: bool)
enum State { CHASING, FLYING, STUNNED, DEAD, MERGING }
static var first_leather_spawned: bool = false
static var first_iron_spawned: bool = false
var kickable_type: String = ""
var tier: int = 1
@@ -54,7 +56,6 @@ func setup(type: String, wave: int) -> void:
enemy_type = type
kickable_type = type
wave_num = wave
tier = enemy_level
match type:
"slime":
move_speed = 2.8 + wave * 0.12
@@ -82,6 +83,7 @@ func setup(type: String, wave: int) -> void:
COLOR_CHASE = Color(0.3, 0.7, 0.3)
mat.albedo_color = COLOR_CHASE
enemy_level = 3
tier = enemy_level
func _physics_process(delta: float) -> void:
match state:
@@ -267,6 +269,14 @@ func _try_drop_pickup() -> void:
get_parent().add_child(leather)
leather.global_position = global_position
if enemy_level == 2:
var drop_iron := not first_iron_spawned or randf() < 0.20
if drop_iron:
first_iron_spawned = true
var iron := IRON_SCENE.instantiate() as Node3D
get_parent().add_child(iron)
iron.global_position = global_position
var roll := randf()
var p_type := ""
var p_heal := 0