bovido/scripts/enemy.gd
Mathilde Grapin 1aed988149 Add a behavior tree to the enemy
Add the Beehave addon.
Make the enemy do the same thing as before but with a behavior tree.
2023-06-12 16:48:35 +02:00

13 lines
357 B
GDScript

extends CharacterBody2D
@onready var tile_map: TileMap = get_parent()
@onready var animation_player = $AnimationPlayer
@export var speed = 80
var y_spawn_offset = -8
var destination: Vector2 = Vector2.ZERO
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