Replies: 2 comments 7 replies
-
FWIW: doing this as work around: onClick(() => {
const pos = mousePos();
const match = get("tile").reduceRight<GameObj | undefined>((acc, go) => {
if (acc && acc.z >= go.z) return acc;
if (go.hasPoint(pos)) return go;
return acc;
}, undefined);
if (match) {
console.debug(`match id:${match.id}, type:${match.tileType}`);
match.destroy();
}
}); |
Beta Was this translation helpful? Give feedback.
0 replies
-
This is the expected behavior, you can check this example which iterates objects in reverse z order to check for mouse click |
Beta Was this translation helpful? Give feedback.
7 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Using kaboom 3000.0.3.
Expect:
onClick
only to trigger on topmost GameObj if there are overlapping areas, especially if they have different zActual: All
onClick
handlers matching mousepos are triggeredExample: https://replit.com/@pjoePanda/kaboom3000-area-click-overlap
Beta Was this translation helpful? Give feedback.
All reactions