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 » Sat Sep 28, 2019 5:16 am

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: 1561
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

Re: Looking for animation logic

Post by ivan » Sat Sep 28, 2019 6:17 am

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 » Sat Sep 28, 2019 8:10 am

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 » Sat Sep 28, 2019 8:58 am

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: 1561
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

Re: Looking for animation logic

Post by ivan » Sat Sep 28, 2019 11:52 am

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 » Sat Sep 28, 2019 12:08 pm

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 » Sun Sep 29, 2019 8:20 am

Ok. I use that method and to now everything works well. Thank you.

User avatar
ivan
Party member
Posts: 1561
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

Re: Looking for animation logic

Post by ivan » Sun Sep 29, 2019 12:11 pm

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 » Sun Sep 29, 2019 2:19 pm

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 » Sun Sep 29, 2019 2:32 pm

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: No registered users and 31 guests