码迷,mamicode.com
首页 > 其他好文 > 详细

coona group 遍历

时间:2015-04-14 08:27:53      阅读:128      评论:0      收藏:0      [点我收藏+]

标签:

-----------------------------------------------------------------------------------------
--
-- main.lua
--
-----------------------------------------------------------------------------------------

local squares = display.newGroup()

local redSquare1 = display.newRect( squares, 0, 0, 40, 40 )
local redSquare2 = display.newRect( squares, 0, 0, 40, 40 )
local redSquare3 = display.newRect( squares, 0, 0, 40, 40 )
redSquare1:setFillColor( 1, 0, 0 )
redSquare2:setFillColor( 1, 0, 0 )
redSquare3:setFillColor( 1, 0, 0 )

--insert only the red squares into a table
local redSquares = { redSquare1, redSquare2, redSquare3 }

for i = 1, #redSquares do
    --manipulate the square at the current index (i)
    redSquares[i].x = redSquares[i].x + i*100
    redSquares[i]:scale( 0.5, 0.5 )
end

 

coona group 遍历

标签:

原文地址:http://www.cnblogs.com/yufenghou/p/4423925.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!