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