Y Tweenlite的位置不动

时间:2014-01-20 06:18:52

标签: actionscript-3 tweenlite

这是我的头脑。我不知道为什么这段代码中的第一个Tweenlite不工作,而第二个是。我正在尝试为练习编码制作一个带有宝石的克隆,这就是我需要珠宝掉落的功能。迹线是正确的,但Y位置不会移动Tweenlite。你们认为是什么造成了这个问题?

    private function dropDownJewels():void
    {
        //trace(map[0]); // traces the x values
        tempInt = 0;
        for ( i=GV.GRID_SIZE_ROWS-1; i!==-1; i-- ) // a backward loop.
        {
            for ( j=GV.GRID_SIZE_COLS-1; j!==-1; j-- )
            {
                //trace(i + "  "  + j);
                //check the jewel to the bottom of this one and if that is gone, then move this gem down.
                if (!map[i][j].gone)
                {
                    map[i][j].jewelDropDist = countRowsBelow(i, j, 0, 1);
                    // now we want jewels above this one to drop with it... so...
                    for ( k=1; k<j+1; k ++)
                    {
                        if (map[i][j-k].gone) { break;}
                        //trace("DSAF");
                        map[i][j-k].jewelDropDist = map[i][j].jewelDropDist;
                        tempInt = j-k;
                        if (map[i][j-k].jewelDropDist >= 1) 
                        {
                            TweenLite.to(map[i][j-k], 10, {y: map[i][j-k].y + (map[i][j-k].jewelDropDist *( GV.JEWEL_HEIGHT + GV.JEWEL_SPACING ) ) });
                            //map[i][j-k].y += map[i][j-k].jewelDropDist *( GV.JEWEL_HEIGHT + GV.JEWEL_SPACING );
                            trace("COPIED: " +map[i][j-k].name + " jewel at " + i + "," + tempInt + " needs to drop " + map[i][j-k].jewelDropDist);
                        }
                    }

                    if (map[i][j].jewelDropDist >= 1) { trace(map[i][j].name + " jewel at " + i + "," + j + " needs to drop " + map[i][j].jewelDropDist); }

                    //map[i][j].gone = true;
                        TweenLite.to(map[i][j], 10, {y: map[i][j].y + (map[i][j].jewelDropDist *( GV.JEWEL_HEIGHT + GV.JEWEL_SPACING ) ) });

                }
            }
        }
    }

0 个答案:

没有答案