ChronoSpace/scenes/weapon/railgun/railgun.gd
2025-08-02 12:27:49 +02:00

14 lines
477 B
GDScript

class_name Railgun extends "res://scenes/weapon/weapon.gd"
@onready var bullet = preload("res://scenes/bullet/bulletRailgun/bulletRailgun.tscn")
func attack():
if cooldownTimer.is_stopped():
spawnBullet()
cooldownTimer.start(cooldown)
func spawnBullet():
var newBullet = bullet.instantiate()
newBullet.spawn(bulletPoint.global_position, get_parent().get_parent().rotation, damage, penetration)
get_tree().get_first_node_in_group("bulletPool").add_child(newBullet)