space-invaders/scripts/enemy.gd

13 lines
283 B
GDScript

class_name Enemy extends RigidBody2D
# there is probably a better built-in to use here
@export var direction:int = 1
const SPEED = 1
func _ready():
pass # Replace with function body.
func _process(_delta):
var x = get_transform().get_origin().x
move_local_x(SPEED * direction)