26 lines
655 B
GDScript
26 lines
655 B
GDScript
extends StaticBody3D
|
|
|
|
@export var jump_amount = 20
|
|
@export var stamina_replenish = true
|
|
@export var ammo_amount = 20
|
|
@onready var jump_sound = $JumpSound
|
|
|
|
# Called when the node enters the scene tree for the first time.
|
|
func _ready():
|
|
pass # Replace with function body.
|
|
|
|
|
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
func _process(delta):
|
|
pass
|
|
|
|
|
|
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
|