add weapon switcher; todo: ammo

This commit is contained in:
Michael Campbell 2026-02-19 01:09:36 -05:00
parent 045faf2333
commit 53b8cf6118
5 changed files with 33 additions and 4 deletions

View file

@ -28,7 +28,13 @@ var state := State.NORMAL
var dash_direction: Vector2
var stamina := 1.0
@onready var gun: Gun = %Mortar
@export var guns: Array[Gun]
var gun_index := 0:
set(v):
gun_index = v % guns.size()
%GunLabel.text = gun.name
var gun: Gun:
get: return guns[gun_index]
func _init() -> void:
instance = self
@ -122,6 +128,9 @@ func _process(delta: float) -> void:
damage_clock -= delta
if Input.is_action_just_pressed("swap_weapons"):
gun_index += 1
func damage(damager: Node3D) -> void:
if state == State.DASHING:
damager.queue_free()