1
1
mirror of https://github.com/Rundll86/Dog-Lynx-And-HCN.git synced 2026-05-28 15:01:53 +08:00
Files
Dog-Lynx-And-HCN/scripts/Contents/Bullets/SCBlock.gd
T

29 lines
796 B
GDScript
Raw Normal View History

extends BulletBase
class_name SCBlockBullet
var speedV2 = Vector2.ZERO
func register():
speedV2 = Vector2(
(launcher.currentFocusedBoss.position - launcher.position)
.sign().x
* randf_range(-0.25, 1)
* 100,
-50
)
func spawn():
var staticTexture = texture.get_node_or_null("static")
if staticTexture is Sprite2D:
var text = load("res://resources/bullets/scblock/%d.png" % randi_range(0, 8))
staticTexture.texture = text
var trail = staticTexture.get_node_or_null("trail")
if trail is GPUParticles2D:
trail.texture = text
func ai():
rotation = speedV2.angle()
speed = speedV2.length()
PresetBulletAI.trace(self , position + Vector2.from_angle(deg_to_rad(90)), lifeTimePercent() / 15)
PresetBulletAI.forward(self , rotation)
speedV2 *= 0.95
speedV2 += Vector2(0, 1)