开发者

Placement of objects displaced every 2nd row

开发者 https://www.devze.com 2023-02-21 22:14 出处:网络
Im looking for a way to place objects displaced from each other on every 2nd row. The objects are being placed like this: http://bit.ly/fpn1GC

Im looking for a way to place objects displaced from each other on every 2nd row.

The objects are being placed like this: http://bit.ly/fpn1GC

for(var i:uint=1;i<12;i++) {
    for(var j:uint=1;j<12;j++) {
        var p:place = new place();

        if(i%2){
            //1-3-5...
            p.x=4开发者_StackOverflow社区0*j;
        }
        else {
            //2-4-6...
            p.x=40*j;
        }
        p.y=29*i;
        addChild(p);
    }
}

Thanks in advance


for(var i:uint=0;i<11;i++) {
    for(var j:uint=0;j<11;j++) {
        var p:place = new place();

        if(i%2){
            //2-4-6...
            p.x=42*j+22;
        }
        else {
            //1-3-5...
            p.x=42*j+42;
        }
        p.y=28*i+20;
        addChild(p);
    }
}
0

精彩评论

暂无评论...
验证码 换一张
取 消