Hey guys, I've started putting animation test together and ran into a problem. For some mysterious reason when I turn left and release the key it'll create weird offset between the standing image and the walking animation but works fine walking right. A little hard to explain so I attached the demo, the code isn't very large so someone who love-savvy should see what I've done wrong reasonably fast. I also including the images in case it's something I missed there.
Any help is much appreciated!
Animation acting weird!
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Animation acting weird!
- Attachments
-
- ONNZ.love
- (27.79 KiB) Downloaded 207 times
Re: Animation acting weird!
... what the hell!? Seems like there's something wrong with the offset when you flip the image.
I wish I had the time to insta-fix bugs as they show up, but I don't ... damn you, life!
Workarounds: use separate images or make it part of the animation and use :seek().
I wish I had the time to insta-fix bugs as they show up, but I don't ... damn you, life!
Workarounds: use separate images or make it part of the animation and use :seek().
- bartbes
- Sex machine
- Posts: 4946
- Joined: Fri Aug 29, 2008 10:35 am
- Location: The Netherlands
- Contact:
Re: Animation acting weird!
Something I could've guessed, the problem is in the 0.3*direction (of stand). Couldn't find the exact problem, but I've come up with a temporary fix:
Instead of the old player.x argument of the draw which is called when stand is needed.
Oh, and the title should be changed, the animation is correct, the image of stand is wrong (I used a dot to figure that one out)
Code: Select all
player.x-((player.direction-1)*-0.5*30),
Oh, and the title should be changed, the animation is correct, the image of stand is wrong (I used a dot to figure that one out)
Re: Animation acting weird!
Thanks that works. Although I don't understand how it works
- bartbes
- Sex machine
- Posts: 4946
- Joined: Fri Aug 29, 2008 10:35 am
- Location: The Netherlands
- Contact:
Re: Animation acting weird!
the
is just a piece of math translating to:
don't know why the offset of 30 is in place, I guess there are 30 pixels added to the right side, which you don't notice when you are looking to the right, but you do when you 'rotate'
Code: Select all
((player.direction-1)*-0.5*30)
Code: Select all
if player.direction == -1 then
player.x = player.x-30
end
Who is online
Users browsing this forum: No registered users and 8 guests