Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 12, 2016, 1:45:44 PM (9 years ago)
Author:
tgidron
Message:

New Pickup

Location:
code/branches/tgidronFS16/src/modules/hover
Files:
4 edited

Legend:

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

    r11177 r11182  
    121121           
    122122
    123             //Generate 5 PickupSpawners randomly (destroy hover pickup)
    124             for (int i = 0; i<5; i++)
     123            //Generate 3 PickupSpawners randomly (destroy hover pickup)
     124            for (int i = 0; i<3; i++)
    125125            {
    126126                PickupSpawner* pickupSpawner = new PickupSpawner(origin_->getContext());
     
    128128                pickupSpawner->setPosition(get3dCoordinates(rand()%numCells, rand()%numCells, 10.0f));
    129129                pickupSpawner->setPickupTemplateName(origin_->getPickupTemplate());
    130                 pickupSpawner->setMaxSpawnedItems(5);
     130                pickupSpawner->setMaxSpawnedItems(3);
    131131                pickupSpawner->setRespawnTime(30);
    132132                pickupSpawner->setTriggerDistance(5);
     
    135135            }
    136136           
    137             //Generate 5 PickupSpawners randomly (damage pickup)
    138             for (int i = 0; i<5; i++)
     137            //Generate 3 PickupSpawners randomly (speed pickup)
     138            for (int i = 0; i<3; i++)
    139139            {
    140140                PickupSpawner* pickupSpawner = new PickupSpawner(origin_->getContext());
    141141
    142142                pickupSpawner->setPosition(get3dCoordinates(rand()%numCells, rand()%numCells, 10.0f));
    143                 pickupSpawner->setPickupTemplateName(origin_->getPickupTemplateDam());
    144                 pickupSpawner->setMaxSpawnedItems(5);
     143                pickupSpawner->setPickupTemplateName(origin_->getPickupTemplateSpeed());
     144                pickupSpawner->setMaxSpawnedItems(3);
    145145                pickupSpawner->setRespawnTime(30);
    146146                pickupSpawner->setTriggerDistance(5);
     
    149149            }
    150150
     151            //Generate 3 PickupSpawners randomly (shrink pickup)
     152            for (int i = 0; i<3; i++)
     153            {
     154                PickupSpawner* pickupSpawner = new PickupSpawner(origin_->getContext());
     155
     156                pickupSpawner->setPosition(get3dCoordinates(rand()%numCells, rand()%numCells, 10.0f));
     157                pickupSpawner->setPickupTemplateName(origin_->getPickupTemplateShrink());
     158                pickupSpawner->setMaxSpawnedItems(3);
     159                pickupSpawner->setRespawnTime(30);
     160                pickupSpawner->setTriggerDistance(5);
     161                // Add pickup spawner to the pickup spawner list
     162                pickupSpawners_.push_back(pickupSpawner);
     163            }
     164
    151165            //*****************************************************************************
    152166
     167            //Generate a destroyable crate randomly on field
     168
    153169            Pawn* crate = new Pawn(origin_->getContext());
    154170
    155171            crate->setPosition(get3dCoordinates(rand()%numCells, rand()%numCells, 10.0f));
    156             crate->addTemplate(origin_->getObstacleTemplate());
    157 
     172            crate->addTemplate(origin_->getObstacleTemplate()); 
     173            crate->setInitialHealth(100.0f);
     174           
    158175
    159176
    160177
    161178             //If no lives are left, end game
    162             if(lives <= 0){
     179            if(lives <= 0)
     180            {
    163181                GSLevel::startMainMenu();
    164182            }
    165 
     183            // Debug
    166184            orxout() << this->origin_->getPickupTemplate() << endl;
    167185            orxout() << this->origin_->getPickupRepresentationTemplate() << endl;
    168186
    169             orxout() << this->origin_->getPickupTemplateDam() << endl;
    170             orxout() << this->origin_->getPickupRepresentationTemplateDam() << endl;
    171         }
     187            orxout() << this->origin_->getPickupTemplateSpeed() << endl;
     188            orxout() << this->origin_->getPickupRepresentationTemplateSpeed() << endl;
     189
     190            orxout() << this->origin_->getObstacleTemplate() << endl;
     191            orxout() << crate->getPosition() << endl;
     192        }
    172193    }
    173194
  • code/branches/tgidronFS16/src/modules/hover/Hover.h

    r11177 r11182  
    9494
    9595            std::vector<PickupSpawner*> pickupSpawners_;
     96           
    9697    };
    9798}
  • code/branches/tgidronFS16/src/modules/hover/HoverOrigin.cc

    r11177 r11182  
    4646        checkGametype();
    4747
    48         pickupTemplate_ = "";
     48        //not needed
     49
     50        /*pickupTemplate_ = "";
    4951        pickupRepresentationTemplate_ = "";
    5052
    51         pickupTemplateDam_ = "";
    52         pickupRepresentationTemplateDam_ = "";
     53        pickupTemplateSpeed_ = "";
     54        pickupRepresentationTemplateSpeed_ = "";
     55
     56
     57        pickupTemplateShrink_ = "";
     58        pickupRepresentationTemplateShrink_ = "";*/
    5359    }
    5460
     
    6268        XMLPortParam(HoverOrigin, "pickuptemplate", setPickupTemplate, getPickupTemplate, xmlelement, mode);
    6369        XMLPortParam(HoverOrigin, "pickuprepresentationtemplate", setPickupRepresentationTemplate, getPickupRepresentationTemplate, xmlelement, mode);
    64         XMLPortParam(HoverOrigin, "pickuptemplatedam", setPickupTemplateDam, getPickupTemplateDam, xmlelement, mode);
    65         XMLPortParam(HoverOrigin, "pickuprepresentationtemplatedam", setPickupRepresentationTemplateDam, getPickupRepresentationTemplateDam, xmlelement, mode);
     70        XMLPortParam(HoverOrigin, "pickuptemplatespeed", setPickupTemplateSpeed, getPickupTemplateSpeed, xmlelement, mode);
     71        XMLPortParam(HoverOrigin, "pickuprepresentationtemplatespeed", setPickupRepresentationTemplateSpeed, getPickupRepresentationTemplateSpeed, xmlelement, mode);
    6672        XMLPortParam(HoverOrigin, "obstacletemplate", setObstacleTemplate, getObstacleTemplate, xmlelement, mode);
     73        XMLPortParam(HoverOrigin, "pickuptemplateshrink", setPickupTemplateShrink, getPickupTemplateShrink, xmlelement, mode);
     74        XMLPortParam(HoverOrigin, "pickuprepresentationtemplateshrink", setPickupRepresentationTemplateShrink, getPickupRepresentationTemplateShrink, xmlelement, mode);
    6775    }
    6876
  • code/branches/tgidronFS16/src/modules/hover/HoverOrigin.h

    r11177 r11182  
    8080            //pickup template get and set for damage hover pickup
    8181
    82             inline void setPickupTemplateDam(std::string pickupTemplateDam)
    83                 { this->pickupTemplateDam_ = pickupTemplateDam; }
    84             inline std::string getPickupTemplateDam() const
    85                 { return this->pickupTemplateDam_; }
     82            inline void setPickupTemplateSpeed(std::string pickupTemplateSpeed)
     83                { this->pickupTemplateSpeed_ = pickupTemplateSpeed; }
     84            inline std::string getPickupTemplateSpeed() const
     85                { return this->pickupTemplateSpeed_; }
    8686
    87             inline void setPickupRepresentationTemplateDam(std::string pickupRepresenationaTemplateDam)
    88                 { this->pickupRepresentationTemplateDam_ = pickupRepresenationaTemplateDam; }
    89             inline std::string getPickupRepresentationTemplateDam() const
    90                 { return this->pickupRepresentationTemplateDam_; }
     87            inline void setPickupRepresentationTemplateSpeed(std::string pickupRepresenationaTemplateSpeed)
     88                { this->pickupRepresentationTemplateSpeed_ = pickupRepresenationaTemplateSpeed; }
     89            inline std::string getPickupRepresentationTemplateSpeed() const
     90                { return this->pickupRepresentationTemplateSpeed_; }
     91
     92
     93            //pickup template get and set for shrink hover pickup
     94
     95            inline void setPickupTemplateShrink(std::string pickupTemplateShrink)
     96                { this->pickupTemplateShrink_ = pickupTemplateShrink; }
     97            inline std::string getPickupTemplateShrink() const
     98                { return this->pickupTemplateShrink_; }
     99
     100            inline void setPickupRepresentationTemplateShrink(std::string pickupRepresenationaTemplateShrink)
     101                { this->pickupRepresentationTemplateShrink_ = pickupRepresenationaTemplateShrink; }
     102            inline std::string getPickupRepresentationTemplateShrink() const
     103                { return this->pickupRepresentationTemplateShrink_; }
    91104
    92105            //get and set for obstacle template
     
    110123
    111124            // Tempaltes for the damage hover pickup
    112             std::string pickupTemplateDam_;
    113             std::string pickupRepresentationTemplateDam_;
     125            std::string pickupTemplateSpeed_;
     126            std::string pickupRepresentationTemplateSpeed_;
     127
     128            // Tempaltes for the shrink hover pickup
     129            std::string pickupTemplateShrink_;
     130            std::string pickupRepresentationTemplateShrink_;
    114131
    115132            //Template for crate obstacle
Note: See TracChangeset for help on using the changeset viewer.