Jump to content

  • Log In with Google      Sign In   
  • Create Account


How to divide character body?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 Tukimitzu   Members   -  Reputation: 106

Like
0Likes
Like

Posted 06 September 2013 - 05:54 PM

Hello!

 

So, I'm making a 2D platformer in C++ with SFML. To animate my characters I used a sprite sheet where each frame has a fixed size and each line of frames is associated with a movement (for now, they are IDLE, WALK, and JUMP)

 

Now I got to a point where I need the head of the character to rotate, and I'm having a hard time on figuring out a nice way to divide the body in separate pieces and draw them togheter.

 

Can someone help me on this?

Thx! smile.png



Sponsor:

#2 PandaDragonThing   Members   -  Reputation: 311

Like
0Likes
Like

Posted 06 September 2013 - 08:15 PM

I imagine you're already doing this, but have one instance draw all the pieces of their relative body. Don't have an instance for each piece.

As for the drawing of pieces, if you're using OpenGL, you want to rotate the piece first by the pieces desired rotation( the unique rotation of the head indifferent from the body ), translate the piece to the center of the instance, rotate again to the instances desired rotation( so rotating the entire character rotates the head with the rest of the body ).

If you have any specific questions, ask away as I'm not entirely sure how you're going about attempting to achieve your goal.



#3 Irlan   Members   -  Reputation: 1455

Like
0Likes
Like

Posted 23 September 2013 - 05:46 PM

For animation switching: States (dead state, walking state)

A "Scene Graph" in 2D (it's possible) it's definitely what you need. Just Google It! Your code will be more Object Oriented and more reusable too. cool.png


Edited by irlanrobson, 23 September 2013 - 05:46 PM.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS