the addChild of CCParallaxNode have one bug for lua
- Posts: 15
virtual void addChild(CCNode * child, unsigned int z, const CCPoint& parallaxRatio, const CCPoint& positionOffset);
the param z is unsigned int.
for tulua++ in luacocos2d.cpp is :
cocos2d::CCParallaxNode* self = (cocos2d::CCParallaxNode*) tolua_tousertype(tolua_S,1,0);
cocos2d::CCNode* child = ((cocos2d::CCNode*) tolua_tousertype(tolua_S,2,0));
unsigned int zOrder = ((unsigned int) tolua_tonumber(tolua_S,3,0));
When "tolua_tonumber(tolua_S,3,0)" is a negative number and lua_number is double,z maybe isn't same with the expected value.
when call CCNode::addChild in CCParallaxNode::addChild, z will convert to int, but it's not same with the value writed in lua codes.
On windows and ios simulator,it work well.
but on Iphone device,it'not work.
So, the addChild of CCParallaxNode should be defined as below:
virtual void addChild(CCNode * child, int z, const CCPoint& parallaxRatio, const CCPoint& positionOffset);
In CCParallaxNode, the interface absolutePosition will be defined as a virtual and public method,because it maybe changed:
virtual CCPoint absolutePosition();