Visible and hittestobject not working

96 views Asked by At

Help me with my code okay so the problem is that the object (text12) is suppose to be visible after object (char1) touches object (char2) but when char1 touches cha2 the text isnt visible even after they touch

jah._visible = false;
if(char1.hitTestObject(char2))
{
jah._visible = true; }
1

There are 1 answers

0
helloflash On

If you want your object jah to be visible only when char1 touches char2, you can write:

if (char1.hitTestObject(char2)) {
    jah._visible = true;
    } else {
    jah._visible = false;
}

bird_mc.hitTest(missile_mc) returns exactly the same Boolean as texte._visible (true or false), so you can also write:

jah._visible = bird_mc.hitTest(missile_mc);