Mathilde Grapin
1aed988149
Add the Beehave addon. Make the enemy do the same thing as before but with a behavior tree.
13 lines
357 B
GDScript
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
|