I'm trying to write tower defense game, compile the operation, but sometimes can appear the following questions, sometimes it's ok, the diagram allenemy put all this monster, this is all on one side of the monster traversal meaning, figure 1 e is not be assigned a success, but j is value, figure 2 in figure 3 allenemy 11 also have value, but is defeated the assignment, why? For help! In addition to the code of the increased monster allenemy. PushBack (e); And delete monster code gamescene: : allbullet eraseObject (e); E - & gt; RemoveFromParent ();
Graph one:
Figure 2:
Figure 3:
CodePudding user response:
Breakpoints and where is the assignment of the line of code is not running?
CodePudding user response:
You put inside is a pointer, is how the assignment? Temporary variable pointer? End of the life cycle will be deleted
CodePudding user response:
Wild pointer, oneself check delete node code, is there a synchronization will be stored in an array of node deletion