class RedSide : public cocos2d::Node
{
public:
virtual bool init();
CREATE_FUNC(RedSide);
cocos2d::Node* plane();
…
public:
unsigned int coodinate;
};
bool RedSide::init()
{
if ( !Node::init() )
{
return false;
}
…
memset(coodinate,0,sizeof(coodinate));
//应用时
EventListenerCustom* listener = EventListenerCustom::create(“robot_attacking”,CC_CALLBACK_1(RedSide::onAttacked, this));
_eventDispatcher->addEventListenerWithFixedPriority(listener, 1);
…
return true;
}
事件响应函数
void RedSide::AttackedByGreen()
{
在这里访问,coodinate的数据,发现是没有初如化过的。值都是随机的。 前面的init 的过程是走过的。
不知问题出在哪???
}
coodinate
unsigned int 4294967295
unsigned int 4294967295
。。。。。。
都是没有初始化的数据。