Home > other > MoveTo move the elves to the target location how to obtain elves coordinates
MoveTo move the elves to the target location how to obtain elves coordinates
Time:09-17
Everyone a great god, and I use moveTo move the elves to the target location, and then get the current coordinates, display or location before moving, I then setposition it in target location, or will go wrong, how can I solve?
CodePudding user response:
Everyone a great god please inform, thank you thank you thank you very much!
CodePudding user response:
You need to write a sequence action sequences, a callback function is executed after moveto, capture or set in the callback function you need the spirit of coordinates
CodePudding user response:
Error code and paste it
CodePudding user response:
Sure is that after the move, is likely to be at the time of runAction take coordinates, so in the first position, join in runAction obtain the coordinates of the code
CodePudding user response:
Code stick, before or after moving coordinates? Impossible!
CodePudding user response:
In fact you when deciding how much to move, knew that the location of the object
You must be obtained before moving coordinates, the cocos the underlying principle is that each frame of mobile elves sets the position of the elves, impossible to move after getPosition is before moving