I was going through the Ray Wenderlich’s Space Game tutorial for android. Great Tutorial.
I am an intermediate C++ programmer and I am trying to understand what’s happening inside here. Just to understand I’ve rewritten it. Removing macros.
class CCPointObject: CCObject
virtual CCPoint getRatio const
virtual void setRatio
m_tRatio = newRatio;
// similarly getChild/setChild/getOffset/setOffset is defined. The code works perfectly fine.
CCPointObjectpoint = (CCPointObject )m_pParallaxArray~~>arr[i];
CCNode * curNode = point~~>getChild;
point->setOffset, offset) );
when point is initialized , how m_tOffset, m_tRatio and m_pChild is initialized to actual values of that Object’s offset and ratio ?
I’ve given CCLogs in setOffset/getOffset functions of CCPointObject, but they have been never called so which setOffset/getOffset is called ? As CCPointObject is inherited from CCObject so I thought, might be CCObject’s setOffset/getOffset is being called but, as i checked, there is no setOffset/getOffset declared in CCObject.
I looked in to ccParallaxNode.h and its there,
//array that holds the offset / ratio of the children
and _ccArray has CCObject* that means Array of CCObjects and CCObject does not have any variable as m_tOffset/m_tRatio or m_pChild so, where actually the offset/ratio is stored ?
These doubts are driving me nuts. Please help