can Collision check avoid colliding with hidden layers?

Discuss any general programming issues here
Post Reply
Bugala
Posts: 1400
Joined: Sun Feb 14, 2010 7:11 pm

can Collision check avoid colliding with hidden layers?

Post 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.
User avatar
fingus
Posts: 271
Joined: Fri Sep 16, 2011 9:53 am

Re: can Collision check avoid colliding with hidden layers?

Post 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).
Bugala
Posts: 1400
Joined: Sun Feb 14, 2010 7:11 pm

Re: can Collision check avoid colliding with hidden layers?

Post 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.
User avatar
airsoftsoftwair
Posts: 5887
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: can Collision check avoid colliding with hidden layers?

Post 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.
Bugala
Posts: 1400
Joined: Sun Feb 14, 2010 7:11 pm

Re: can Collision check avoid colliding with hidden layers?

Post by Bugala »

Ah, that didnt come to my mind. Thanks Andreas!
Post Reply