sg's devastating arrows debone cops

This commit is contained in:
pennyrigate 2023-03-25 13:36:04 -04:00
parent 149f0ecafe
commit c67d1ca257

View file

@ -9,6 +9,9 @@ export var idle_turns = 0
export var turn_time = 0.5
export var shoot_time = 1.0
export var bones_amount = 5
export var bones_speed = 50.0
onready var sprite = $AnimatedSprite
onready var shoot_position = $"%ShootPosition"
onready var shoot_cast = $"%ShootCast"
@ -20,6 +23,8 @@ onready var muzzle_flash = $"%MuzzleFlashParticles"
var shooting = false
var turns = 0
const BoneParticle = preload("res://objects/enemy/bone_particle.tscn")
func _ready():
if Engine.editor_hint:
update()
@ -137,3 +142,15 @@ func _set_right_boundary(value):
right_boundary = value
if Engine.editor_hint:
update()
func die():
for n in bones_amount:
var bone = BoneParticle.instance()
bone.rotation = rand_range(0.0, 2.0*PI) # random rotation
bone.global_position = global_position
bone.linear_velocity = Vector2(bones_speed * rand_range(0.5, 1.5), 0.0).rotated(rand_range(-PI, 0.0))
bone.angular_velocity = rand_range(-PI*2.0, PI*2.0)
var timer = get_tree().create_timer(3.0 + rand_range(0.0, 1.0), false)
timer.connect("timeout", bone, "queue_free")
get_parent().call_deferred("add_child", bone)
.die() # call rest of enemy.gd die() funciton