14 lines
368 B
GDScript
14 lines
368 B
GDScript
class_name Enemy
|
|
extends CharacterBody2D
|
|
|
|
const Y_SPAWN_OFFSET = -8
|
|
@export var speed = 80
|
|
@onready var tile_map: TileMap = get_parent()
|
|
@onready var animation_player = $AnimationPlayer
|
|
@onready var sprite = $Sprite2D
|
|
|
|
func _ready():
|
|
var spawn_cell: Vector2i = tile_map.get_top_spawn_cell()
|
|
position = tile_map.map_to_local(spawn_cell)
|
|
position.y += Y_SPAWN_OFFSET
|