mardi 28 novembre 2017

AS3 - Remove object permanently after leaving and coming back to frame

I'm creating a game, in this game you need to shoot 1 of 4 boats, shooting each one will make you go into a mini game. I want to be able to shoot a boat, it take me to the mini-game and then upon completing that i want to return to the original screen but have that boat removed. My code is looking like this,

    if (root["missile" + i].hitTestObject(ship1)) {
        gotoAndPlay(4);
        removeChild(ship1);
    }
    if (root["missile" + i].hitTestObject(ship2)) {
        gotoAndPlay(5);
        removeChild(ship2);
    }
    if (root["missile" + i].hitTestObject(ship3)) {
        gotoAndPlay(6);
        removeChild(ship3);
    }
    if (root["missile" + i].hitTestObject(ship4)) {
        gotoAndPlay(7);
        removeChild(ship4);
    }

With the above code, the ship is still present when returning. Any help would be greatly appreciated.

Aucun commentaire:

Enregistrer un commentaire