Depending on the arc of your sword you could simply check if the enemy
is 'in front' of the player when they collide by checking their
relative x/y positions. If the enemy is in front of the player and a
collision is registered when the player is swinging the sword then you
could assume that the enemy has been hit by the sword.
Nick
Hi, I'm working on a simple game, and I want the main character (a
sprite) to attack with a sword when the user presses a button. Any
enemies touching the sword should do a method (getting damaged or
something), but any enemy touching the character and not the sword
should not do this method. One way to solve this problem would be to
simply make an extra sprite, so the character would be one sprite, and
the sword would be a separate one. Is there any easier way of doing
this?
_______________________________________________
Unsubscribe or switch delivery mode:
<http://support.realsoftware.com/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
|