Page 1 of 1

animations with love2d

Posted: Mon Aug 22, 2022 1:07 am
by Seth144k
Hi so im using this amazing library for love2D called anim8 its pretty good but im having alot of trouble with flipping for the left animation... I have no clue where to start and I attempted this using a number of diffrent ways but to no luck... i hope one of you can help me please

Re: animations with love2d

Posted: Mon Aug 22, 2022 2:32 am
by ReFreezed
Try setting animation.flippedV to true/false, or specify a negative x-scale value (sx) when you call animation:draw().

Re: animations with love2d

Posted: Tue Aug 23, 2022 9:30 am
by knorke
Folder animX has a captial X but in code there is animx = require("animx") with lowercase x. That makes it fail on sytems that are casesensitive:
main.lua:1: module 'animx' not found:
no field package.preload['animx']
no 'animx' in LOVE game directories.
The character is flickering when moving to left direction because he is quickly flipping between left&right orientation.
in function player:update(dt)

Code: Select all

 if love.keyboard.isDown("a") then
        self.x = self.x - self.speed * dt
        self.anim:flipH() 
        self.isMoving = true
every frame when "a" is hold down, flipH() gets called. You only want to call it once, when the dude begins moving to the left.