Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hi
would like to code a game using composition in XNA. I have 4 characters for my game namely Monster , Dog, Person and the user controlled sprite namely snake. The Monster, Dog and Person have 3 states namely: Running State, walking state and dying state. For each state there is a sprite sheet for each character repectfully.

My problem is how make use composition (inheritance/polymorphism) to accommodate for this.
Scenario: If the snake sprite collides with either of the 3 sprites, the sprite's (Moster, Dog or Person) state should change to a running state and the running sprite sheet should be drawn at the exact position of the previous sprite (walking state), Flipped-Horizontally and move in the opposite direction with respect to the previous sprite(walking state)..... The same applys for the dying state.

Can anyone pls help I have been stuck for more than a day now!

Thank in Advance.
Novy
Posted
Updated 26-Oct-12 4:35am
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900