0

顔の背景と顔の前景の 2 つのレイヤーで構成された、アニメーション化されたスマイリー フェイスが必要だとします。

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

コロナがこれらのレイヤーを単一のオブジェクト/エンティティとして扱うように、Lua でこれを書き出すにはどうすればよいですか? 単一のエンティティで作業したいと思います(衝突、アニメーション化された動きなど)。

4

2 に答える 2

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
于 2012-04-30T13:44:24.807 に答える
1

これがお役に立てば幸いです。

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

数字が大きいほど前もってイメージです

于 2012-05-16T05:06:44.063 に答える