I'm making a game in XNA called The Adventure Of The Very Hairy Princess Fairy. The game is a "Sidescroller/Platformer" like mario but there is a problem. How do I attach a weapon to the player texture and add animations so it looks like the player is holding the gun and It's not a floating image in front of the player? The player can kill with things like chainsaws playing as a very hairy princess fairy.

| improve this question | | | | |
  • 3
    \$\begingroup\$ Wow, a very hairy princess fairy with chainsaws, that's so wacky! Who would have thought those things could go together?! \$\endgroup\$ – ssb Nov 9 '12 at 6:08
  • \$\begingroup\$ I'm sure this has been answered before. We've got a question on the best practices for approaching this, and one on doing the character's arms separately, but I haven't found a canon question how bits of sprites can be combined. \$\endgroup\$ – doppelgreener Nov 9 '12 at 7:46

I'm assuming you are using the PSK, correct?

If you are, one thing to do would be to add another animation to the player class. Have an animation for the weapon, with states for idle and attacking. draw them right after you do your player. If you don't want the weapon to show up when you aren't attacking, leave the idle animation as a blank canvas.

Another option is to just add an animation to the player for attacking directly. Add a bool, isAttacking, and when it is true, play the attack animation.

| improve this answer | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.