Home > other >  Cocos2dx3. X how private data transfer??
Cocos2dx3. X how private data transfer??

Time:09-25

Set up several private data
Item_0 - & gt; SetUserObject (new RechargeEntity (0, 1));
Item_1 - & gt; SetUserObject (new RechargeEntity (0, 2));
Item_2 - & gt; SetUserObject (new RechargeEntity (0, 3));

In the click event to take when they became empty...
If (item_0 - & gt; GetBoundingBox (.) containsPoint (touch - & gt; GetLocation ())) {
RechargeEntity * re0=(RechargeEntity *) item_0 - & gt; GetUserData ();
}
If (item_1 - & gt; GetBoundingBox (.) containsPoint (touch - & gt; GetLocation ())) {
RechargeEntity * re1=(RechargeEntity *) item_1 - & gt; GetUserData ();
}
If (item_2 - & gt; GetBoundingBox (.) containsPoint (touch - & gt; GetLocation ())) {
Re2 RechargeEntity *=(RechargeEntity *) item_2 - & gt; GetUserData ();
}


Why re1, re2 out is null???????
Why re0 item_2 was private data...

This is how to return a responsibility???????
  • Related