Looking for animation logic

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
ilovelove2019
Citizen
Posts: 78
Joined: Wed Sep 11, 2019 10:38 am

Looking for animation logic

Post by ilovelove2019 »

Hello everyone. I had a problem that had been around for a long time, ever since I started learning game programming until now. Every time I make projects about platform games, I meet them. The problem is how to manage animation for the movements of the character in the most reasonable way. I want animation to suit each type of character movement such as: jump, run, ... Every time I develop more features for the character, adding animation for me is very difficult. I have tried many but have encountered bugs every time. That is logic error.That made me depressed and had given up with many games.

More specific. My character has these animation: idle, run, jump, crouch, climb, hurt. I need your help. I meet a lot of logic error when manage them. I think I don't have a proper method yet. Can anyone help me please? Thank you so much!

If you need I will send my dump code in the comment.
User avatar
ivan
Party member
Posts: 1911
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

Re: Looking for animation logic

Post by ivan »

I wrote a short tutorial on how to make animations:
https://2dengine.com/?p=animation
There are more sophisticated libraries out there,
but I think you can easily implement it yourself.
ilovelove2019
Citizen
Posts: 78
Joined: Wed Sep 11, 2019 10:38 am

Re: Looking for animation logic

Post by ilovelove2019 »

Oh. May be my bad english make you miss understand.
ilovelove2019
Citizen
Posts: 78
Joined: Wed Sep 11, 2019 10:38 am

Re: Looking for animation logic

Post by ilovelove2019 »

I use anim8 library to make animation. It's OK. The problem is logic. I don't know how to switch animation when player walk, jump, hurt,...
User avatar
ivan
Party member
Posts: 1911
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

Re: Looking for animation logic

Post by ivan »

Oh, I see.
This is actually a very good question.
You could have different states for the player where each state has its own animation.
Just keep in mind that the player only be in one state at a time.
ilovelove2019
Citizen
Posts: 78
Joined: Wed Sep 11, 2019 10:38 am

Re: Looking for animation logic

Post by ilovelove2019 »

It mean I need to create a variable named state to storage state of my player?
ilovelove2019
Citizen
Posts: 78
Joined: Wed Sep 11, 2019 10:38 am

Re: Looking for animation logic

Post by ilovelove2019 »

Ok. I use that method and to now everything works well. Thank you.
User avatar
ivan
Party member
Posts: 1911
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

Re: Looking for animation logic

Post by ivan »

Take a look at my tutorial:
https://2dengine.com/?p=fsm
I have modified it specifically to answer your question.
ilovelove2019
Citizen
Posts: 78
Joined: Wed Sep 11, 2019 10:38 am

Re: Looking for animation logic

Post by ilovelove2019 »

Ah yes! Good solution. Good tutorial. It help me a lot! Thank you!
ilovelove2019
Citizen
Posts: 78
Joined: Wed Sep 11, 2019 10:38 am

Re: Looking for animation logic

Post by ilovelove2019 »

I have visited your site. And I see your work so amazing! I see you have some project public on Steam. Good work. Keep doing.
Post Reply

Who is online

Users browsing this forum: Bing [Bot], Semrush [Bot] and 33 guests