Home > other >  How about cocos2d - x tanks stops can always stop at the grid position
How about cocos2d - x tanks stops can always stop at the grid position

Time:09-19

Tanks by setting the speed to move, but the process of moving, found that sometimes turn into a clearing, always get no position, the position of the dock can't stop in the grid, to overcome, to achieve 4399 classic tanks war effect, always stop when the tank stopped in the grid. Ever get, give a solution, also don't want to put the tank scale is too small!

CodePudding user response:

1. Please do not use the UI to judge logic, but a logical manager to do this,
2. When your tanks moved some distance, more than the threshold value of each grid, then you think tanks in the grid, then determine whether can through certain obstacles can use logical location information in the manager to do judgment,

, of course, if you capricious, you want to use the UI to process logic,
That please move every time distance is fixed, in particular, do not according to the duration of the button, to move the unit of distance, but every time after moving, lock button event, in the mobile, after the completion of a lattice to monitor events, so that it can be, do, of course, will make you can't walk snakeskin,
  • Related