1
1
mirror of https://github.com/Rundll86/Dog-Lynx-And-HCN.git synced 2026-05-28 06:51:54 +08:00
Files
Dog-Lynx-And-HCN/scripts/Contents/Bullets/ChainGun.gd
T

28 lines
765 B
GDScript
Raw Normal View History

extends BulletBase
class_name ChainGunBullet
var count: int = 0
var splits: float = 0
var cycleRate: float = 0
var cycleCount: float = 0
@onready var anchor: Node2D = $"%anchor"
func spawn():
for i in count:
for bullet in BulletBase.generate(
ComponentManager.getBullet("PurpleCrystalSmall"),
launcher,
anchor.global_position,
rotation + deg_to_rad(splits * randf_range(-1, 1))
):
if bullet is PurpleCrystalBullet:
var dir = Vector2.from_angle(bullet.rotation).rotated(deg_to_rad(-90))
bullet.baseDamage = baseDamage
bullet.position += dir * (count - i * 2) * 10 / 2
bullet.penerate += penerate
bullet.cycleRate = cycleRate
bullet.cycleCount = cycleCount
func ai():
PresetBulletAI.lockLauncher(self , launcher, true)