14 lines
308 B
GDScript
14 lines
308 B
GDScript
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
|