more hud work
This commit is contained in:
@@ -5,6 +5,9 @@ extends StaticBody3D
|
||||
@export var ammo_amount = 20
|
||||
@onready var jump_sound = $JumpSound
|
||||
|
||||
var can_jump = false
|
||||
var player
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
pass # Replace with function body.
|
||||
@@ -12,14 +15,17 @@ func _ready():
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta):
|
||||
pass
|
||||
if can_jump:
|
||||
if Input.is_action_just_pressed("jump"):
|
||||
player.velocity.y = jump_amount
|
||||
jump_sound.play()
|
||||
|
||||
|
||||
func _on_area_3d_body_entered(body):
|
||||
if body.is_in_group("player"):
|
||||
body.velocity.y = jump_amount
|
||||
jump_sound.play()
|
||||
if body.ammo < body.gun.max_ammo + ammo_amount:
|
||||
body.ammo += ammo_amount
|
||||
if stamina_replenish == true:
|
||||
body.remaining_stamina = body.MAX_STAMINA
|
||||
can_jump = true
|
||||
player = body
|
||||
|
||||
func _on_area_3d_body_exited(body: Node3D) -> void:
|
||||
if body.is_in_group("player"):
|
||||
can_jump = false
|
||||
|
||||
Reference in New Issue
Block a user