Collision detection of enemy and player bullets first:
Code:
Gamelayer . h
void Gamelayer::update (float dt) {for (int i = 0; i < m_penermyvec.size (), i++) {Sprite * Pene = m_penermyvec.at (i); for ( int j = 0; J < M_pplayerbullet.size (); j + +) {Sprite * Pbul = m_pplayerbullet.at (j); if (Pene->getboundingbox (). Intersectsrect (Pbul->getboundingbox ())) {pene->stopallactions ();p bul->stopallactions ();p ene->runaction (Sequence::create (FadeOut::create (0.5f) , Removeself::create (True), nullptr));p bul->runaction (Removeself::create (true)); M_penermyvec.eraseobject (PEne ); M_pplayerbullet.eraseobject (Pbul); i--; j--;}}}
This is the basic function of the game logic is finished, the following will be the main research under the bomb screen.
Source: http://pan.baidu.com/s/1bntWUC3
only Class and the Resource
Aircraft War Development 04 bullet collision detection with enemy aircraft