…layer?
I’m writing simple tile map editor so I’d like to know how to detect if object collides with anything on layer object is on.
…layer?
I’m writing simple tile map editor so I’d like to know how to detect if object collides with anything on layer object is on.
Add an object group called “Everything”.
Check collision between your object and “Everything”.
That’s not quite what I meant.
Let’s say there are layers A and B. On both layers there is same amount of objects (some objects have instances on both layer A and Layer B). When I make object on layer A, I want to check if it collides with object on layer A and no other layer. Same when I place object on layer B - I want to check collisions only with objects on layer B and no other layer.
Your solution would check for collisions on BOTH layers, which is unwanted.
Give each object a variable ‘layer’ and do = 0 for layer 0, = 1 for layer 1 etc. Then you can do this (pseudocode):
Create objectA on layer 1.
Do = 1 to variable layer of objectA
For each object ‘everything’
variable layer of object everything is = objectA.Variable(layer) |||| Action: Check for collision
Hm, kinda hacky, but might work.