Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 21, 2016, 3:37:28 PM (8 years ago)
Author:
tgidron
Message:

Pickups work; Lives Counter and Total Flag Counter

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/tgidronFS16/src/modules/hover/Hover.cc

    r11169 r11171  
    4040#include "core/CoreIncludes.h"
    4141#include "gamestates/GSLevel.h"
     42#include "HoverShip.h"
    4243
    4344#include "pickup/PickupSpawner.h"
     
    5758        level = 1; //start at level 1
    5859        flagsTaken = 0;// took 0 flags in the beginning
     60        lives = 3;
    5961
    6062        numCells = 0;
     
    132134                pickupSpawners_.push_back(pickupSpawner);
    133135            }
     136             //If no lives are left, end game
     137            if(lives <= 0){
     138                GSLevel::startMainMenu();
     139            }
    134140
    135141            orxout() << this->origin_->getPickupTemplate() << endl;
     
    153159            for (int i = 0; i<5; i++)
    154160            {
    155                 PickupSpawner* pickup = new PickupSpawner(origin_->getContext());
    156                 //PickupSpawner->setPosition(rand()%numCells, rand()%numCells, cellSize);
    157                 //pickup->createDroppedPickup(this->getContext(), pickup , this, 5);
    158                 pickupSpawners_.push_back(pickup);
     161                PickupSpawner* pickupSpawner = new PickupSpawner(origin_->getContext());
     162
     163                pickupSpawner->setPosition(get3dCoordinates(rand()%numCells, rand()%numCells, 10.0f));
     164                pickupSpawner->setPickupTemplateName(origin_->getPickupTemplate());
     165                pickupSpawner->setMaxSpawnedItems(5);
     166                pickupSpawner->setRespawnTime(30);
     167                pickupSpawner->setTriggerDistance(5);
     168                // Add pickup spawner to the pickup spawner list
     169                pickupSpawners_.push_back(pickupSpawner);
    159170            }
    160171
     
    185196        }
    186197        numberOfFlags_ = flags_.size();
     198
     199        if(lives <= 0){
     200                GSLevel::startMainMenu();
     201            }
    187202    }
    188203
     
    198213        return Vector3(x*cellSize*1.0f + cellSize/2, heightOffset, y*cellSize*1.0f + cellSize/2);
    199214    }
     215
     216    void Hover::costLife()
     217    {
     218        lives--;
     219        if (lives <= 0)
     220            GSLevel::startMainMenu();
     221    }
    200222}
Note: See TracChangeset for help on using the changeset viewer.