For Example, There is a tree(image) and i want to destroy it. I want my character only destroy it (For example the character must be facing the tree to destroy it and there must be a range were you can destroy. How do i do this? Note: THis is a game made with slick!
closed as not a real question by Byte56, Laurent Couvidou, Jonathan Hobbs, John McDonald, Trevor Powell Sep 20 '12 at 5:20
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, see the FAQ.
To figure out whether the player is facing the tree or not, get the angle from the player to the tree and the angle the player is facing. If the absolute value of the difference is less than a certain amount, the player is facing the tree.
For range, just use the distance formula.
Note: Your character need to be in that pos to destroy it! I'm working on the code for range attacks...
Link to full source code: http://systemnetworks.comeze.com/Source%20Codes.php