You can pick an object based on its variable quite simply. Just use conditions "MyObject : compare instance variable", multiple ones in the same event, to "filter" every of the MyObjects to just keep the one that validate every conditions (if none validate everything, the events won't be run).
Or... If you come from "real coding", go for functions then
You can do a function "checkCube", waiting for 2 parameters (X and Y).
Functions in C2 work in different ways :
- you can have as many parameters as you like
- a function can use "pause" instruction, but will loose its context (and parameters)
- a function can act (meaning it can use actions and influence the game like any other events)
- a function can also be called "inline", in witch case it will be "evaluated" and the return value will be used where you called the function.
- a function can set a return value.
Here are some examples I made, and the manual