In the current cocos2d-x 3.0rc0 distribution, the method "isEqual" doesn't seem to be available for CCNode. Using

node1->isEqual(node2)

I get an error saying "error: 'cocos2d::CCNode' has no member named 'isEqual'" )

How can I compare two nodes then?

Thanks.

有帮助吗?

解决方案

If pointer equality suffices:

if (node1 == node2) { .. }

Otherwise you'd have to implement an equality test function that does a member-by-member comparison, at least for those that you consider important for an equality test.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top