12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- #include "ChampDeBataille.h"
- ChampDeBataille::ChampDeBataille(Joueur* cible,SDL_Surface* ecran,int niveauDeDifficulte):m_niveauDeDifficulte(niveauDeDifficulte),m_ecran(ecran)
- {
- for (int i(0);i<30;i++)
- {
- m_slotsHelico[i]=0;//Pour la sécurité des pointeurs
- }
- for (int i(0);i<10+optionsFire::difficulte*10;i++)
- {
- m_slotsHelico[i]= new Helico(ecran,10,i);
- }
- m_bossOne= new BossOne(ecran,cible);
- m_cible=cible;
- }
- ChampDeBataille::~ChampDeBataille()
- {
- for (int i(0);i<10+optionsFire::difficulte*10;i++)
- {
- delete(m_slotsHelico[i]);
- }
- delete (m_bossOne);
- }
- void ChampDeBataille::afficher()
- {
- int nbVivant(0);
- for (int i(0);i<10+optionsFire::difficulte*10;i++)
- {
- if (m_slotsHelico[i]->estVivant())
- {
- m_slotsHelico[i]->afficher();
- nbVivant++;
- }
- }
- if ((nbVivant!=0 )&&( !takeRand(70-2*nbVivant,SDL_GetTicks())))
- {
- m_cible->recevoirDegats(1+optionsFire::difficulte);
- }
- if (!nbVivant && m_bossOne->estVivant())
- {
- m_bossOne->afficher();
- }
- }
|