Changeset 11169
- Timestamp:
- Apr 17, 2016, 8:40:05 PM (9 years ago)
- Location:
- code/branches/tgidronFS16
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/tgidronFS16/data/levels/Hover.oxw
r11168 r11169 25 25 ?> 26 26 27 <?lua28 include("templates/pickupRepresentationTemplates.oxt")29 include("includes/pickups.oxi")30 ?>31 32 27 <Template name=destroyhoverpickupRepresentation> 33 28 <PickupRepresentation> … … 46 41 </Template> 47 42 48 <Template name=destroy metapickup baseclass=MetaPickup>49 <MetaPickup representation="destroy " metaType="destroy" />43 <Template name=destroyhoverpickup baseclass=MetaPickup> 44 <MetaPickup representation="destroyhover" metaType="destroy" /> 50 45 </Template> 51 52 <PickupRepresentation53 name = "destroyhover"54 pickupName = "Destroy Carrier Pickup"55 pickupDescription = "destroys you."56 spawnerTemplate = "destroyhoverpickupRepresentation"57 inventoryRepresentation = "destroyCarrierPickup"58 />59 60 46 61 47 <Level … … 66 52 <Template link=lodtemplate_default /> 67 53 </templates> 54 68 55 <?lua include("includes/notifications.oxi") ?> 69 56 … … 77 64 > 78 65 66 <PickupRepresentation 67 name = "destroyhover" 68 pickupName = "Destroy Hover Pickup" 69 pickupDescription = "destroys you." 70 spawnerTemplate = "destroyhoverpickupRepresentation" 71 inventoryRepresentation = "destroyHoverPickup" 72 /> 73 79 74 <StaticEntity position="0,0,0" collisionType="static"> 80 75 <attached> … … 83 78 cellSize="<?lua print(MAZE_CELL_SIZE)?>" 84 79 cellHeight="<?lua print(MAZE_CELL_HEIGHT)?>" 85 pickuptemplate=destroyhoverpickup Representation86 pickup base=destroymetapickup80 pickuptemplate=destroyhoverpickup 81 pickuprepresentationtemplate=destroyhoverpickupRepresentation 87 82 /> 88 83 <Model -
code/branches/tgidronFS16/data/overlays/HoverHUD.oxo
r11168 r11169 76 76 showpoints = true 77 77 /> 78 79 80 78 </OverlayGroup> 81 82 </OverlayGroup>83 84 79 85 80 </Template> -
code/branches/tgidronFS16/src/modules/hover/Hover.cc
r11168 r11169 98 98 for(int y=0; y<numCells; y++){ 99 99 for(int x=0; x<numCells; x++){ 100 switch(levelcode[ y * numCells + x ]){ 100 switch(levelcode[ y * numCells + x ]) 101 { 101 102 case 1: (new HoverWall(origin_->getContext()))->init(x+1, numCells-y, cellSize, cellHeight, 1); 102 103 break; 103 104 case 3: (new HoverWall(origin_->getContext()))->init(x+1, numCells-y, cellSize, cellHeight, 1); 104 105 case 2: (new HoverWall(origin_->getContext()))->init(x+1, numCells-y, cellSize, cellHeight, 0); 105 default: break; 106 default: 107 break; 106 108 } 107 } 109 } 108 110 } 109 111 … … 120 122 for (int i = 0; i<5; i++) 121 123 { 122 PickupSpawner* pickup = new PickupSpawner(origin_->getContext()); 123 pickup->setPosition(rand()%numCells, rand()%numCells, cellSize); 124 //pickup->setPickupTemplateName(origin_->getPickupMeta()); 125 //pickup->setPickupTemplateName("destroymetapickup"); 126 pickup->setMaxSpawnedItems(5); 127 pickup->setRespawnTime(30); 128 pickup->setTriggerDistance(5); 129 //pickup->createDroppedPickup(this->getContext(), pickup , this, 5); 130 pickups_.push_back(pickup); 131 } 132 133 124 PickupSpawner* pickupSpawner = new PickupSpawner(origin_->getContext()); 125 126 pickupSpawner->setPosition(get3dCoordinates(rand()%numCells, rand()%numCells, 10.0f)); 127 pickupSpawner->setPickupTemplateName(origin_->getPickupTemplate()); 128 pickupSpawner->setMaxSpawnedItems(5); 129 pickupSpawner->setRespawnTime(30); 130 pickupSpawner->setTriggerDistance(5); 131 // Add pickup spawner to the pickup spawner list 132 pickupSpawners_.push_back(pickupSpawner); 133 } 134 135 orxout() << this->origin_->getPickupTemplate() << endl; 136 orxout() << this->origin_->getPickupRepresentationTemplate() << endl; 134 137 } 135 138 } 136 139 137 140 138 139 void Hover::startLevel(){ 141 // Rename/delete this function. 142 void Hover::startLevel() 143 { 140 144 //Generate 5 flags randomly (test only 1 flag) 141 145 for ( int i = 0; i < 5; i++ ) … … 152 156 //PickupSpawner->setPosition(rand()%numCells, rand()%numCells, cellSize); 153 157 //pickup->createDroppedPickup(this->getContext(), pickup , this, 5); 154 pickups_.push_back(pickup); 155 } 156 158 pickupSpawners_.push_back(pickup); 159 } 160 161 157 162 } 158 163 … … 163 168 164 169 // Check if ship collided with one of the flags 165 for ( unsigned int i = 0; i < flags_.size(); i++ ){ 166 if(flags_[i]->getCollided()){ 170 for ( unsigned int i = 0; i < flags_.size(); i++ ) 171 { 172 if(flags_[i]->getCollided()) 173 { 167 174 flags_[i]->destroyLater(); 168 175 flags_.erase (flags_.begin()+i); … … 186 193 187 194 } 195 196 Vector3 Hover::get3dCoordinates(int x, int y, float heightOffset) 197 { 198 return Vector3(x*cellSize*1.0f + cellSize/2, heightOffset, y*cellSize*1.0f + cellSize/2); 199 } 188 200 } -
code/branches/tgidronFS16/src/modules/hover/Hover.h
r11168 r11169 61 61 void endLevel(); 62 62 63 64 65 63 inline int getNumberOfFlags() const 66 64 { return this->numberOfFlags_; } 65 66 virtual Vector3 get3dCoordinates(int x, int y, float heightOffset); 67 67 68 68 private: … … 81 81 int totFlags; 82 82 83 std::vector<PickupSpawner*> pickup s_;83 std::vector<PickupSpawner*> pickupSpawners_; 84 84 }; 85 85 } -
code/branches/tgidronFS16/src/modules/hover/HoverOrigin.cc
r11168 r11169 45 45 RegisterObject(HoverOrigin); 46 46 checkGametype(); 47 48 pickupTemplate_ = ""; 49 pickupRepresentationTemplate_ = ""; 47 50 } 48 51 … … 54 57 XMLPortParam(HoverOrigin, "cellSize", setCellSize, getCellSize, xmlelement, mode); 55 58 XMLPortParam(HoverOrigin, "cellHeight", setCellHeight, getCellHeight, xmlelement, mode); 56 XMLPortParam(HoverOrigin, "pickuptemplate", setPickup , getPickup, xmlelement, mode);57 XMLPortParam(HoverOrigin, "pickup base", setPickupMeta, getPickupMeta, xmlelement, mode);59 XMLPortParam(HoverOrigin, "pickuptemplate", setPickupTemplate, getPickupTemplate, xmlelement, mode); 60 XMLPortParam(HoverOrigin, "pickuprepresentationtemplate", setPickupRepresentationTemplate, getPickupRepresentationTemplate, xmlelement, mode); 58 61 } 59 62 -
code/branches/tgidronFS16/src/modules/hover/HoverOrigin.h
r11168 r11169 66 66 { return this->cellHeight_; } 67 67 68 inline void setPickup (std::string pickuptemplate)69 { this->pickupTemplate_ = pickup template; }70 inline std::string getPickup () const68 inline void setPickupTemplate(std::string pickupTemplate) 69 { this->pickupTemplate_ = pickupTemplate; } 70 inline std::string getPickupTemplate() const 71 71 { return this->pickupTemplate_; } 72 72 73 inline void setPickup Meta(std::string pickupbase)74 { this->pickup Meta_ = pickupbase; }75 inline std::string getPickup Meta() const76 { return this->pickup Meta_; }73 inline void setPickupRepresentationTemplate(std::string pickupRepresenationaTemplate) 74 { this->pickupRepresentationTemplate_ = pickupRepresenationaTemplate; } 75 inline std::string getPickupRepresentationTemplate() const 76 { return this->pickupRepresentationTemplate_; } 77 77 78 78 private: … … 82 82 int cellSize_; 83 83 int cellHeight_; 84 85 // Tempaltes for the destroy hover pickup 84 86 std::string pickupTemplate_; 85 std::string pickup Meta_;87 std::string pickupRepresentationTemplate_; 86 88 }; 87 89 }
Note: See TracChangeset
for help on using the changeset viewer.