- Joined
- Oct 18, 2015
- Messages
- 16
- Reaction score
- 2
- First Language
- English
- Primarily Uses
I'm trying to compare the player's position with the position of an event to determine when a player is within 2 tiles of the event horizontally and 3 tiles vertically north of the event. I'm wanting this to work for the current event that the code is placed within so it works with each event of this type, but I can't figure out the correct java variables to use for the current event position.
An example of this would be (according to my limited java script knowledge):
if (($gamePlayer._x <= ($currentEvent._x + 2)) && ($gamePlayer._x >= ($currentEvent._x - 2)) && ($gamePlayer._y <= ($currentEvent._y + 3)) && ($gamePlayer._y >= $currentEvent._y))
but I know that $currentEvent isn't correct.
Does any one know how to access the position of the current event to use in a condition that's compared with the player's position?
An example of this would be (according to my limited java script knowledge):
if (($gamePlayer._x <= ($currentEvent._x + 2)) && ($gamePlayer._x >= ($currentEvent._x - 2)) && ($gamePlayer._y <= ($currentEvent._y + 3)) && ($gamePlayer._y >= $currentEvent._y))
but I know that $currentEvent isn't correct.
Does any one know how to access the position of the current event to use in a condition that's compared with the player's position?