add weapon switcher; todo: ammo
This commit is contained in:
parent
045faf2333
commit
53b8cf6118
5 changed files with 33 additions and 4 deletions
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue