Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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.

share|improve this question
3  
Wow, a very hairy princess fairy with chainsaws, that's so wacky! Who would have thought those things could go together?! –  ssb Nov 9 '12 at 6:08
    
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. –  Jonathan Hobbs Nov 9 '12 at 7:46
add comment

1 Answer

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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