Armazon/scripts/gun_tip.gd

14 lines
308 B
GDScript3
Raw Permalink Normal View History

2024-01-28 13:44:54 -05:00
extends Node3D
const gunblast = preload("res://props/explosion/gun_blast.tscn")
@export var chance: float = 0.1
func _on_collide(_f: float):
if randf() < chance:
add_child(gunblast.instantiate())
$gunshot.visible = true
$Timer.start(0.1)
func _on_timer_timeout() -> void:
$gunshot.visible = false