I have scenario in which I need to understand where should I use scene and where should I use layer. Scenario water开发者_运维技巧 is moving and fish is floating there some objects are coming fish needs to kill them by throughing any object.fish is also animated? please help where should I use scene and layer and how?
simple
if u have dependent between layers
then add them in same(one) Scene
otherwise just use different scene
Example
water fish object are dependent between them
like
water will flow continiously in background
fish will swim in it
object also floating in it
so
water has fish
water has object
moreover
if the object collide with fish then
fish should be killed.
so fish and object are dependent.
so create three layers for water,fish,object
each layer will handle its seperate touch events
by
layer.isTouchEnabled=YES;
one thing while arrangement of adding layer is important
inside water the fish can be live . so it has to inside
so
first add fish then object then ur water
water layer should be faded and transparent
so look like ur fish and object are inside water.
now one bug is while touching the fish not affect the fish .why?
bcause water is added last . so inside of water touch began method u should really handle the fish layer.
精彩评论