extends "res://objects/enemy/enemy.gd" #How far to move export var up_boundary = 0.0 export var down_boundary = 0.0 #Start direction var direction = Vector2(1,1) export var speed = 50 #Move horizontal or vertical export(int, "/", "\\") var move_direction #Onreadys onready var startpos = position func _ready(): death_sound = Audio.a_explosion up_boundary *= 8 down_boundary *= 8 #Move in direction selected if move_direction == 0: direction = Vector2(1,-1) # adjust to difficulty speed *= Game.enemy_speed_factor func _physics_process(delta): #Move position += direction * (speed * delta) #Switch dir if position.y >= startpos.y + (down_boundary): direction *= -1 if position.y <= startpos.y - (up_boundary): direction *= -1 func die(): .die()