1. Aircraft Launch Bullet type
To achieve the flying effect of the bullet, and do not want to calculate the location in each frame update, the best way to call Ccmoveto
When a bullet is fired, it can be Cctouchbegan:
ccmoveto* move = Ccmoveto::create (0.4f, CCP (_plane->getposition (). X+WINSIZE.WIDTH/4, _plane->getposition (). Y) );//range is 1/4 of the screen, starting point is the position of the aircraft, 0.4 seconds to complete the range _bullet->runaction (move, cccallfuncn::create (this, Callfuncn_selector (Baselayer::bulletremove)), (NULL)); When the bullets are finished, remember to destroy them.
The way to destroy bullets depends on project, which is my own project notation:
void Baselayer::bulletremove (ccnode* spend) {ccsprite* sprite = (ccsprite*) spend;//convert the Ccnode transferred to a bullet//destroy the bullet from the array _ Bulletarray->removeobject (Sprite, True); _batchnode->removechild (Sprite, True); Actually destroy the bullet from the batch node.