2012-04-30 13 views
0

顔の背景+顔の前景の2つのレイヤーで構成されたアニメーション笑顔の顔が必要だとします。Lua/Corona SDKを使用して階層化されたイメージを作成/操作する方法は?

背景レイヤーは単純な色/テクスチャです。 前景レイヤーはアニメーションレイヤー(アニメーション笑顔、泣き声、笑い声など)です。

コロナがこれらのレイヤーを単一のオブジェクト/エンティティとして扱うように、これをLuaに書き込むにはどうすればよいですか?私は、単一のエンティティが(衝突、アニメ運動などのために)働くことを望みます。

答えて

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) 

グレーター画像

関連する問題