How to make only part of an actor collidable?
Hi, I'm making a game where arrows are shooting out of a tower at enemies, but when it shoots the enemy instead of the arrow head hitting the enemy the end of the arrow hits the enemy. Is there a way I can make only the top part of the arrow collide with the enemy and destroy it, and only the top. Or is there a way I can make a mini separate actor that is invisible that sticks to the arrow and only when that mini actor hits the enemy it destroys it? The second way would probably be better.
Best Answers
-
simo103 Posts: 1,331
@sparx13 ... yes your second way is best. Here is some info:
http://forums.gamesalad.com/discussion/46451/help-constraining-actors
http://forums.gamesalad.com/discussion/38105/constraining-1-actor-to-another-while-both-rotate-in-sync-with-each-other -
jamie_c ImagineLabs.rocks Posts: 5,772
Hi Sparkx13,
I had posted a simple project here showing how to constrain one actor to another. It's still available for download if you're interested.
www.clay-communications.com/jamie/constrain-actors-together.zip
Jamie
-
RThurman Posts: 2,881
Here is an equation to put into the angle:
vectorToAngle( game.Mouse.Position.X - self.Position.X , game.Mouse.Position.Y - self.Position.Y )
Currently it will point to the mouse. You can modify it to get it to point at your moving target.
Answers
Then it will be easier to give you formulas/equations that will get it flying in the correct direction.
The arrow's beginning direction (angle) will be between 0 and 359 degrees. Zero points directly to the right, 90 points directly up, 180 points directly to the left, and 270 points directly down.
Use a "Rotate To Angle" behavior to make the arrow point in the direction you want.