Page 1 of 1

can Collision check avoid colliding with hidden layers?

Posted: Sat Aug 11, 2012 8:22 pm
by Bugala
I am using collision(#LAYER, id1 ,id2) and i ran into something i didnt want to happen.

I have used HideLayer() for id2, and when i do collision check between id1 and id2, it detects it as collision despite the id2 being hidden.

Is there a way to check for collision so that if one of the layers to be checked is hidden, it wouldnt report true then?

I can make workaround for this of course, but i would prefer if there would be command that would handle this for me.

Re: can Collision check avoid colliding with hidden layers?

Posted: Tue Aug 14, 2012 10:04 am
by fingus
I use the trick just not to hide a layer but move it to offscreen outside screen boundarys (above, left, right or down of it).

Re: can Collision check avoid colliding with hidden layers?

Posted: Tue Aug 14, 2012 1:00 pm
by Bugala
but then there comes the problem that you need to know the location where the layer is supposed to be displayed at.

I only put the layer to its place at beginning, after that i only keep hiding and showing it, without any knowledge where the actual x and y are supposed to be at.

Re: can Collision check avoid colliding with hidden layers?

Posted: Fri Aug 17, 2012 6:26 pm
by airsoftsoftwair
Well, just write a wrapper function that checks the #ATTRVISIBLE attribute of the layer and only calls Collision() when both layers are visible.

Re: can Collision check avoid colliding with hidden layers?

Posted: Fri Aug 17, 2012 6:37 pm
by Bugala
Ah, that didnt come to my mind. Thanks Andreas!