|
position_meeting(x,y,obj) |
|
x = Horizontal position y = Vertical position obj = The object to meet the x and y coordinates
Example:
This formula will see if the x and y position of the object using it has the object: obj_monster. This is the equivalent of the drag&drop If there is an object at position. This can be very useful to detect collision with objects some steps before the real impact. E. g.: If an object has a vertical speed of 30 and he must stop on the floor, he will likely pass through the floor because the collision detection of Game Maker is not very accurate at high speed. To make it land beautifully, we can use:
Read: If obj_land is at position: x and y+5, and the vertical speed is greater than 25, set the vertical speed to 15.
You can also use this formula to get better pre-collision event, e. g.: If a monster is 3 pixel away from you, you could prefer to loose health now, and make the player or the monster bounce away from each other, to prevent multi collision, resulting in major health lost (it can be quite annoying) To prevent this, you can use:
Read: if obj_monster is at position: x+3 and y, bounce against all precisely and with obj_monster, bounce against all precisely. You can replace the x and y coordinate by any other coordinate, with or without implying the x or y.
Remember, that if you want to check the position_meeting by another obj from an object, you simply use the name of the object (dot) x coordinate and so on for y. e. g.:
Gabry Hyrule - Revision #1 |