2012-04-30 34 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) 

大数量更多的前期是图像