顔の背景と顔の前景の 2 つのレイヤーで構成された、アニメーション化されたスマイリー フェイスが必要だとします。
背景レイヤーは単純な色/テクスチャです。前景レイヤーはアニメーション レイヤーです (アニメーションの笑顔、泣き声、笑い声など)。
コロナがこれらのレイヤーを単一のオブジェクト/エンティティとして扱うように、Lua でこれを書き出すにはどうすればよいですか? 単一のエンティティで作業したいと思います(衝突、アニメーション化された動きなど)。
これは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
これがお役に立てば幸いです。
smiley:insert(1,background)
smiley:insert(2,emotion)
数字が大きいほど前もってイメージです