Ui Rebuild and Full Controller Support #59

Merged
Snoweuph merged 29 commits from dev-base into stable 2023-04-11 20:41:55 +00:00
Showing only changes of commit b284b325c9 - Show all commits

View file

@ -71,17 +71,13 @@ func sub_on_death(callback : Callable):
func update_animation():
match self.velocity:
Vector2.ZERO: animation_player.play("Idle")
_: handle_diagonal_animations(self.velocity)
pass
_:
var left_dot = Vector2.LEFT.dot(self.velocity)
var right_dot = Vector2.RIGHT.dot(self.velocity)
var up_dot = Vector2.UP.dot(self.velocity)
var down_dot = Vector2.DOWN.dot(self.velocity)
func handle_diagonal_animations(dir : Vector2):
var left_dot = Vector2.LEFT.dot(dir)
var right_dot = Vector2.RIGHT.dot(dir)
var up_dot = Vector2.UP.dot(dir)
var down_dot = Vector2.DOWN.dot(dir)
var max_dot = minf(left_dot, minf(right_dot, minf(up_dot, down_dot)))
var max_dot = maxf(left_dot, maxf(right_dot, maxf(up_dot, down_dot)))
match max_dot:
left_dot: animation_player.play("MoveLeft")
right_dot: animation_player.play("MoveRight")