bovido/scripts/enemy.gd
Mathilde Grapin 5970aa2ac2 Flip enemy and use blackboard
Use blackboard for destination.
2023-06-12 18:50:58 +02:00

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