made archers and roboturrets syncable

This commit is contained in:
pennyrigate 2023-09-15 21:27:37 -04:00
parent 902ec2c4a9
commit ffba0c6620
4 changed files with 110 additions and 12 deletions

View file

@ -8,9 +8,11 @@ onready var timer = $Timer
onready var anims = $AnimationPlayer
onready var shootpos = $ShootPos
onready var raycast = $RayCast2D
onready var muzzle_flash = $MuzzleFlashParticles
const ArrowProjectile = preload("res://objects/enemy/roboturret_proj.tscn")
func _ready():
timer.start(shoot_time)
death_sound = Audio.a_die_robot
# adjust to difficulty
shoot_time /= Game.enemy_speed_factor
@ -23,17 +25,16 @@ func _physics_process(delta):
anims.play("turn right")
else:
anims.play("turn left")
#Do not charge up offscreen
if Game.get_sector(position) != Game.current_sector: timer.start()
func spawn_bullet():
muzzle_flash.emitting = true
var arrow = ArrowProjectile.instance()
arrow.global_position = global_position + (shootpos.position * scale)
arrow.direction = sign(shootpos.position.x) * scale.x
arrow.target_group = "player_hitbox"
arrow.speed = arrow_speed
Game.get_map().add_child(arrow)
timer.start(shoot_time)
func die():
.die()