开发者

How to drag layers in sync

开发者 https://www.devze.com 2022-12-09 01:55 出处:网络
I have a layer and several child layer to this main layer. I can drag each child layer separately using ccTouchMoved method. I need to drag the main layer so the other layers will 开发者_StackOverflow

I have a layer and several child layer to this main layer. I can drag each child layer separately using ccTouchMoved method. I need to drag the main layer so the other layers will 开发者_StackOverflow中文版follow, but how Can I drag the main layer through the ccTouchMoved? Thank you.


You can drag the main layer in the same way you can drag the child layers

Either, you can have a child layer accept the ccTouchMoved and then have that layer send a message to the parent. parent.position = CGPointMake(x, y) in example

Or, you can have the child layers ignore the ccTouchMoved event until it's propagated to the main layer (which obviously has to be touch enabled for this to work)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号