You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

33 lines
785 B

extends Actor
enum PlayerState { NORMAL = 0, # < default from Actor
DASHING = 1,
STANDING = 2,
ATTACKING = 3 };
var screen_size # Size of the game window.
var velocity = Vector2()
var direction_vector = Vector2(1, 0) # to the right by default
func start(pos):
position = pos
state_map = {PlayerState.NORMAL: PlayerNormal.new()}
state_map[PlayerState.NORMAL].ready(self)
show()
func _process(delta):
delta = 0
state_map[state].process(self)
func _physics_process(delta):
state_map[state].input(self)
state_map[state].physics_process(self, delta)
func _ready():
screen_size = get_viewport_rect().size
func _on_AnimatedSprite_animation_finished():
state_map[state].sprite_finished(self)
func get_animated_sprite():
return $AnimatedSprite