Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 16, 2015, 4:24:41 PM (9 years ago)
Author:
erbj
Message:

added timer in tick function to pause for 10 seconds between waves , trying to solve the problem, that towers are shooting at (0,0,0) (center point). The Problem seems to be in the sameteam function as the turret and the pawn at the position (0,0,0) should have the same team

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/towerdefenseFS15/src/modules/towerdefense/TowerDefense.cc

    r10351 r10368  
    9898    RegisterUnloadableClass(TowerDefense);
    9999
    100     TowerDefense::TowerDefense(Context* context) : Deathmatch(context)
     100    TowerDefense::TowerDefense(Context* context) : TeamDeathmatch(context)
    101101    {
    102102        RegisterObject(TowerDefense);
     
    108108        }*/
    109109
     110        selectedPos = new TDCoordinate(0,0);
     111//        TowerDefenseSelecter Selecter = new TowerDefenseSelecter();
    110112
    111113
    112114        this->setHUDTemplate("TowerDefenseHUD");
     115        this->nextwaveTimer_.setTimer(10, false, createExecutor(createFunctor(&TowerDefense::nextwave, this)));
     116        this->nextwaveTimer_.stopTimer();
     117        this->waves_ = 0;
     118        this->time = 0;
     119        this->credit_ = 0;
     120        this->lifes_ = 0;
    113121
    114122        //this->stats_ = new TowerDefensePlayerStats();
     
    138146    {
    139147
    140         Deathmatch::start();
     148        TeamDeathmatch::start();
    141149
    142150// Waypoints: [1,3] [10,3] [10,11] [13,11] -> add the points to a matrix so the player cant place towers on the path
     
    220228    {
    221229
    222         Deathmatch::end();
     230        TeamDeathmatch::end();
    223231        ChatManager::message("Match is over! Gameover!");
    224232
     
    330338        std::vector<TDCoordinate*> path;
    331339        path.push_back(coord1);
    332         if(time>1 && TowerDefenseEnemyvector.size() < 30)
     340        if(time>=TowerDefenseEnemyvector.size() && TowerDefenseEnemyvector.size() < 30)
    333341        {
    334342            //adds different types of enemys depending on the WaveNumber
    335343            addTowerDefenseEnemy(path, this->getWaveNumber() % 3 +1 );
    336             time = time-1;
    337344        }
    338345
     
    359366            }
    360367        }
     368
    361369        //goes thorugh vector to see if an enemy is still alive. if not next wave is launched
    362370        int count= 0;
     
    369377        }
    370378
     379        if (count == 0 && !this->nextwaveTimer_.isActive())
     380            this->nextwaveTimer_.startTimer();
     381
     382/*            time2 +=dt;
    371383        if(count== 0)
    372384        {
    373             time2 +=dt;
    374385            if(time2 > 10)
    375386            {
     
    380391            }
    381392        }
    382 
     393*/
    383394
    384395    }
     
    425436    void TowerDefense::playerEntered(PlayerInfo* player)
    426437    {
    427         Deathmatch::playerEntered(player);
     438        TeamDeathmatch::playerEntered(player);
    428439
    429440        const std::string& message = player->getName() + " entered the game";
     
    433444    bool TowerDefense::playerLeft(PlayerInfo* player)
    434445    {
    435         bool valid_player = Deathmatch::playerLeft(player);
     446        bool valid_player = TeamDeathmatch::playerLeft(player);
    436447
    437448        if (valid_player)
     
    463474        }
    464475
    465         Deathmatch::pawnKilled(victim, killer);
     476        TeamDeathmatch::pawnKilled(victim, killer);
    466477    }
    467478
Note: See TracChangeset for help on using the changeset viewer.