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/VectorStar.gd
T
fallingshrimp 8088723333 feat(VectorStar): 添加子弹折射功能
为 VectorStar 子弹类型添加 refract 方法,处理子弹折射时的行为,与 split 方法保持一致的逻辑
2026-01-17 12:36:22 +08:00

25 lines
813 B
GDScript

extends BulletBase
class_name VectorStar
var tracer: EntityBase = null
var forwardTime: float = 1000
var forwarded: bool = false
var rotateSpeed: float = 1
func ai():
texture.rotation_degrees += rotateSpeed
rotateSpeed += 0.25
PresetBulletAI.forward(self, rotation)
if timeLived() <= forwardTime:
speed = 10 * ((forwardTime - timeLived()) / forwardTime)
else:
speed = (timeLived() - forwardTime) / 30
if is_instance_valid(tracer):
rotation = position.angle_to_point(tracer.getTrackingAnchor())
func split(newBullet: BulletBase, _index: int, _total: int, _lastBullet: float):
if newBullet is VectorStar:
newBullet.forwarded = false
func refract(newBullet: BulletBase, _entity: EntityBase, _index: int, _total: int, _lastBullet: float):
if newBullet is VectorStar:
newBullet.forwarded = false