Collision Detection Advanced
TouchTiltGames
Member Posts: 1,162
I want to record a score for when an object hits an actor (enemy character) in a particular area. So for the head: 50 points, body: 25 points and legs: 10 points for example. Right now I've got it set up so that if the enemy is hit you get X points but I want to break its body up into 3 sections.
Is the best way to do this by using invisible/constrained actors for the body parts if when hit then X points? Or is there an easier way?
Is the best way to do this by using invisible/constrained actors for the body parts if when hit then X points? Or is there an easier way?
Comments
Best of luck.
_______________
Nesen Probe http://itunes.apple.com/us/app/nesen-probe/id377766693?mt=8
Tickle Stones http://itunes.apple.com/us/app/tickle-stones/id363484260?mt=8
Food Fight! (free) http://itunes.apple.com/us/app/food-fight/id352646643?mt=8
Create a game attribute that gets set to the current bullet's Y when ever a collision happens. That logic would be in the bullet actor.
In the enemy, have it compare the value of game.CurrentBulletY to its own Y position when it senses a collision.
Lets says your enemy actor's head makes up the top 1/4 of the actor...
When collides with Bullet AND
When game.CurrentBulletY is >= self.Y+(self.height/4):
"Head Shot"
You mean 3 separate attributes? So: player1 x player 1 y, player2 x player 2 y, player3 x player3 y....
http://gamesalad.com/game/play/68537
I have not upgraded to 0.8.8 yet, but the screen came up with the gun and the enemies with the three different shaded areas.
Thanks for putting this together.
I know it's not really well commented, but I think it's a pretty comprehensible demo regardless...