Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Pickups work; Lives Counter and Total Flag Counter

Location:
code/branches/tgidronFS16
Files:
2 added
2 deleted
8 edited

Legend:

Unmodified
Added
Removed
  • code/branches/tgidronFS16/data/levels/Hover.oxw

    r11169 r11171  
    4242
    4343<Template name=destroyhoverpickup baseclass=MetaPickup>
    44   <MetaPickup representation="destroyhover" metaType="destroy" />
     44  <MetaPickup representation="destroyhover" metaType="destroyCarrier" />
    4545</Template>
    4646
  • code/branches/tgidronFS16/data/levels/includes/weaponSettingsHover.oxi

    r11168 r11171  
    1717    </Weapon>
    1818    <Weapon>
    19       <EnergyDrink mode=0 munitionpershot=0 delay=0     damage=9.3 material="Flares/point_lensflare" muzzleoffset=" 0.8, 1, -18.0" projectileMesh="LaserBeam2.mesh" />
     19      <EnergyDrink mode=0 munitionpershot=0 delay=0  material="Flares/point_lensflare" muzzleoffset=" 0.8, 1, -18.0" projectileMesh="LaserBeam2.mesh" />
    2020    </Weapon>
    2121  </WeaponPack>
  • code/branches/tgidronFS16/data/overlays/HoverHUD.oxo

    r11169 r11171  
    5757
    5858    <OverlayText
    59      position  = "0.02, 0.02"
     59     position  = "0.02, 0.08"
    6060     pickpoint = "0.0, 0.0"
    6161     font      = "ShareTechMono"
     
    6666    />
    6767
    68     <TotalFlagsHUD
     68    <OverlayText
     69     position  = "0.02, 0.12"
     70     pickpoint = "0.0, 0.0"
     71     font      = "ShareTechMono"
     72     textsize  = 0.04
     73     colour    = "1.0, 1.0, 1.0, 1.0"
     74     align     = "left"
     75     caption   = "Lives: "
     76    />
     77
     78    <FlagsAndLivesHUD
    6979     position  = "0.14, 0.02"
    7080     pickpoint = "0.0, 0.0"
     
    7383     colour    = "1.0, 1.0, 1.0, 1.0"
    7484     align     = "left"
     85     showLives = false
     86     />
    7587
    76      showpoints     = true
    77     />
     88     <FlagsAndLivesHUD
     89     position  = "0.14, 0.04"
     90     pickpoint = "0.0, 0.0"
     91     font      = "ShareTechMono"
     92     textsize  = 0.04
     93     colour    = "1.0, 1.0, 1.0, 1.0"
     94     align     = "left"
     95     showLives = true
     96
     97     />
     98
    7899  </OverlayGroup>
    79100
  • code/branches/tgidronFS16/src/modules/hover/CMakeLists.txt

    r11168 r11171  
    88  FlagHUD.cc
    99  MazeGenerator.cc
     10  FlagsAndLivesHUD.cc
    1011)
    1112
  • 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}
  • code/branches/tgidronFS16/src/modules/hover/Hover.h

    r11169 r11171  
    3737
    3838#include "HoverPrereqs.h"
     39#include "HoverShip.h"
    3940
    4041#include <vector>
     
    6061            void levelUp();
    6162            void endLevel();
     63            void costLife();
    6264
    6365            inline int getNumberOfFlags() const
     
    6668            virtual Vector3 get3dCoordinates(int x, int y, float heightOffset);
    6769
     70            inline int getTotFlags() const
     71                { return this->totFlags; }
     72
     73            inline int getLives() const
     74                { return this->lives; }
     75
    6876        private:
     77
    6978            WeakPtr<HoverOrigin> origin_;
    7079            std::vector<HoverFlag*> flags_;
  • code/branches/tgidronFS16/src/modules/hover/HoverShip.cc

    r11151 r11171  
    3333#include "core/CoreIncludes.h"
    3434#include "core/XMLPort.h"
     35#include "Hover.h"
    3536//#include "NewHumanController.h"
    3637
     
    122123        }
    123124    }
     125
     126    Hover* HoverShip::getGame()
     127    {
     128        if (game == nullptr)
     129        {
     130            for (Hover* hover : ObjectList<Hover>())
     131                game = hover;
     132        }
     133        return game;
     134    }
     135
     136    void HoverShip::death()
     137    {
     138        getGame()->costLife();
     139        SpaceShip::death();
     140    }
    124141}
  • code/branches/tgidronFS16/src/modules/hover/HoverShip.h

    r11071 r11171  
    3434
    3535#include "HoverPrereqs.h"
     36#include "Hover.h"
    3637
    3738#include "worldentities/pawns/SpaceShip.h"
     
    6970            virtual void boost(bool bBoost) override;
    7071
     72        protected:
     73            virtual void death() override;
     74
    7175        private:
     76            Hover* getGame();
     77            WeakPtr<Hover> game;
    7278            float jumpBoost_;
    7379            bool isFloor_;
Note: See TracChangeset for help on using the changeset viewer.