GML using place_meeting() in combination with a path to call its index

Yavga

Member
Hello community,

I am looking to program the following:

- When object instance "A" crosses the position of a path in the room, recognize it and give me its index.

The idea I have is to put objects (platforms) on top of a Path that I created within the room editor so it will recognize said path (because they meet) and move along the path it meets, this would save me a lot of time experimenting with level design.

The problem I face is that I cannot think of a correct way to do this as place_meeting or position_meeting needs to address a object and paths do not count as objects. (or so it seems to me)

could anyone help me out?

thanks!
 

kupo15

Member
Hello community,

I am looking to program the following:

- When object instance "A" crosses the position of a path in the room, recognize it and give me its index.

The idea I have is to put objects (platforms) on top of a Path that I created within the room editor so it will recognize said path (because they meet) and move along the path it meets, this would save me a lot of time experimenting with level design.

The problem I face is that I cannot think of a correct way to do this as place_meeting or position_meeting needs to address a object and paths do not count as objects. (or so it seems to me)

could anyone help me out?

thanks!
Well you can't use collision functions for this because it requires an object with a mask and paths aren't that. An idea you can try is use the path_get_x/y functions. You can loop through the path at different index intervals and check the x/y coor of the player to see if they are close enough to it to trigger it.

Does it have to exactly cross a path at any point in it or is this just for testing purposes and you want to create a simple positional trigger for it?
 

Yavga

Member
Well you can't use collision functions for this because it requires an object with a mask and paths aren't that. An idea you can try is use the path_get_x/y functions. You can loop through the path at different index intervals and check the x/y coor of the player to see if they are close enough to it to trigger it.

Does it have to exactly cross a path at any point in it or is this just for testing purposes and you want to create a simple positional trigger for it?
It is simply for testing purposes, I figured it would save me a lot of time instead of creating arrays for each specific room.
I was also thinking of creating my own path system where different line objects basically work the same way as tiles do where a platform object follows said line objects and looks for the next, this way I could use the place_meeting function and do more with paths, this will probably cost more resources though.
 
Top