space-invaders/scripts/enemy.gd

13 lines
283 B
GDScript3
Raw Normal View History

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