13 lines
357 B
GDScript3
13 lines
357 B
GDScript3
|
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
|