I’m using a sprite the moves 8 directions, and I also have a 4 Idle animation for him, Up, Down Left, Right.
The problem is that the up animation the only one that’ll show after a while.
For example If I go right and stop it’ll show the Right Idle animation then start to move left It’ll show the left Idle animation and won’t show the right Idle animation then the down won’t show both the left and right Idle animation, and the up doesn’t show the Right, Left and, Down Idle animation
function update(self, dt)
if self.actions[hash("Left")] then
play_animation(self, hash("Player Left"))
self.direction.x = -self.speed
elseif self.actions[hash("Right")] then
play_animation(self, hash("Player Right"))
self.direction.x = self.speed
else
self.direction.x = 0
end
if self.actions[hash("Up")] then
play_animation(self, hash("Player Up"))
self.direction.y = self.speed
elseif self.actions[hash("Down")] then
play_animation(self, hash("Player Down"))
self.direction.y = -self.speed
else
self.direction.y = 0
end
if self.direction.x == 0 and self.direction.y == 0 and self.actions[hash("Up")] == false then
play_animation(self, hash("Idle Up"))
elseif self.direction.x == 0 and self.direction.y == 0 and self.actions[hash("Down")] == false then
play_animation(self, hash("Idle Down"))
elseif self.direction.x == 0 and self.direction.y == 0 and self.actions[hash("Left")] == false then
play_animation(self, hash("Idle Left"))
elseif self.direction.x == 0 and self.direction.y == 0 and self.actions[hash("Right")] == false then
play_animation(self, hash("Idle Right"))
end