dimanche 26 mars 2017

Array: Term is undefined & has no properties

c is just a letter that I used for the array set. The bold line is the main problem.

function coinsCollect()
{
    coins_txt.text=score;

    This line simply calls on all the objects in the specified array (i.e. coins) amd applies the codes to all objects in the array.

    for(var c:int = 0; c < coins.length; c++) 
    {
        for more precise collision, use hitTestPoint
        **if(coins[c].hitTestPoint(player_mc.x,player_mc.y,true))**
        {
            score+=1;

sound effect for coin sounds; same sound channel is used for all sound effects
            effectsChannel=jewelsSound.play();
            volDown.volume=.1;
            effectsChannel.soundTransform=volDown;
            //frame 2 of coins is a blank keyframe
            coins[c].gotoAndStop(2);
        }

Aucun commentaire:

Enregistrer un commentaire