You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
719 B
GDScript
30 lines
719 B
GDScript
extends Actor
|
|
|
|
enum PlayerState { NORMAL = 0, # < default from Actor
|
|
DASHING = 1,
|
|
STANDING = 2,
|
|
ATTACKING = 3 };
|
|
|
|
var screen_size # Size of the game window.
|
|
var last_process_velocity = Vector2()
|
|
|
|
func start(pos):
|
|
position = pos
|
|
state_map = {PlayerState.NORMAL: PlayerNormal.new(),
|
|
PlayerState.DASHING: PlayerDash.new(),
|
|
PlayerState.STANDING: PlayerStanding.new(),
|
|
PlayerState.ATTACKING: PlayerAttack.new()}
|
|
show()
|
|
|
|
func _process(delta):
|
|
state_map[state].run(self, delta)
|
|
|
|
func _ready():
|
|
screen_size = get_viewport_rect().size
|
|
|
|
func _on_AnimatedSprite_animation_finished():
|
|
state_map[state].spriteFinished(self)
|
|
|
|
func getAnimatedSprite():
|
|
return $AnimatedSprite
|