bovido/scripts/player.gd
Mathilde Grapin 7038d29d87 First commit
Add simple player movement with a finite state machine.
Add enemy that can move to target point.
Add ground through a tilemap and wall that player and enemy cannot
cross.
2023-06-11 23:38:54 +02:00

14 lines
371 B
GDScript

class_name Player
extends CharacterBody2D
@export var speed = 120
var y_spawn_offset = -8
@onready var animation_player = $AnimationPlayer
@onready var sprite = $Sprite2D
@onready var tile_map: TileMap = get_parent()
func _ready():
var spawn_cell: Vector2i = tile_map.get_bottom_spawn_cell()
position = tile_map.map_to_local(spawn_cell)
position.y += y_spawn_offset