2012-04-30 31 views
0

假設我想組成〜2層動畫笑臉:面部背景+面前景。如何創建/使用的Lua /科羅娜SDK分層圖像的工作?

背景層是一個簡單的顏色/紋理。 前景層是動畫層(動畫微笑,哭泣,笑...等)。

我該如何在Lua中寫這樣的話,Corona會將這些圖層作爲單個對象/實體對待?我想一個單一的實體(碰撞,動畫運動...等)的工作。

回答

2

我會用displayGroup來做到這一點。

事情是這樣的:

local smiley = display.newGroup() 
local emotion = display.newImage("happy.png") 
local background = display.newImage("background.png") 

smiley:insert(background) 
smiley:insert(emotion) 

-- moving smiley will also move background and emotion 
-- because they are attached to the smiley displayGroup 
smiley.x = 100 
smiley.y = 100 
+0

感謝。太容易了! – AlvinfromDiaspar

1

希望這有助於你出去。

smiley:insert(1,background) 
smiley:insert(2,emotion) 

大數量更多的前期是圖像