Changeset 10158 for code/branches
- Timestamp:
- Dec 5, 2014, 3:43:28 PM (10 years ago)
- Location:
- code/branches/towerdefenseHS14
- Files:
-
- 1 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/towerdefenseHS14/data/levels/templates/tower.oxt
r10146 r10158 47 47 explosionchunks = 6 48 48 49 reloadrate = 350 reloadwaittime = 149 reloadrate = 10 50 reloadwaittime = 5 51 51 52 52 collisionType = "dynamic" … … 59 59 <Model position="0,0,0" scale=45 mesh="Tower.mesh" /> 60 60 61 <Turret collisionType="dynamic" position="0,0,10" direction="0,0,1" pitch="0" yaw="0" roll="0" angularDamping=0.999999 mass=100 maxPitch=90 maxYaw=90 maxAttackRadius=1000 minAttackRadius=30>61 <Turret reloadrate=10 reloadwaittime=5 collisionType="dynamic" position="0,0,10" direction="0,0,1" pitch="0" yaw="0" roll="0" angularDamping=0.999999 mass=100 maxPitch=90 maxYaw=90 maxAttackRadius=1000 minAttackRadius=30> 62 62 63 63 <controller> … … 83 83 </TowerDefenseTower> 84 84 </Template> 85 86 87 88 <Template name=towerturret1> 89 <TowerDefenseTower 90 91 92 explosionchunks = 6 93 94 reloadrate = 10 95 reloadwaittime = 5 96 97 collisionType = "dynamic" 98 team = 1 99 100 101 > 102 <attached> 103 104 105 <Turret reloadrate=10 reloadwaittime=5 collisionType="dynamic" position="0,0,10" direction="0,0,1" pitch="0" yaw="0" roll="0" angularDamping=0.999999 mass=100 maxPitch=90 maxYaw=90 maxAttackRadius=1000 minAttackRadius=30> 106 107 <controller> 108 <TurretController/> 109 </controller> 110 <?lua 111 include("../includes/weaponSettingsTurret1.oxi") 112 ?> 113 </Turret> 114 115 </attached> 116 117 118 119 120 <!--collisionShapes> 121 122 </collisionShapes--> 123 124 <?lua 125 include("../includes/towerWeaponSettings.oxi") 126 ?> 127 </TowerDefenseTower> 128 </Template> -
code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefense.cc
r10151 r10158 106 106 /* Temporary hack to allow the player to add towers */ 107 107 this->dedicatedAddTower_ = createConsoleCommand( "addTower", createExecutor( createFunctor(&TowerDefense::addTower, this) ) ); 108 this->dedicatedUpgradeTower_ = createConsoleCommand( "upgradeTower", createExecutor( createFunctor(&TowerDefense::upgradeTower, this) ) ); 108 109 } 109 110 … … 130 131 131 132 Deathmatch::start(); 133 credits = 5000; 134 life = 20; 135 waves = 0; 136 time=0.0; 132 137 133 138 // Waypoints: [1,3] [10,3] [10,11] [13,11] … … 234 239 } 235 240 241 void TowerDefense::upgradeTower(int x,int y) 242 { 243 const TowerCost upgraeCost = TDDefaultUpgradeCost; 244 245 if (!this->hasEnoughCreditForTower(upgraeCost)) 246 { 247 orxout() << "not enough credit: " << (this->stats_->getCredit()) << " available, " << TDDefaultTowerCost << " needed."; 248 return; 249 } 250 251 if (towermatrix [x][y] == NULL) 252 { 253 orxout() << "no tower on this position" << endl; 254 return; 255 } 256 257 else 258 { 259 (towermatrix [x][y])->upgradeTower(); 260 } 261 } 236 262 237 263 … … 287 313 { 288 314 return ((this->stats_->getCredit()) >= towerCost); 315 } 316 317 bool TowerDefense::hasEnoughCreditForUpgrade() 318 { 319 return true; 289 320 } 290 321 -
code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefense.h
r10151 r10158 78 78 void addTower(int x, int y); 79 79 80 void upgradeTower(int x, int y); 80 81 /* Part of a temporary hack to allow the player to add towers */ 81 82 ConsoleCommand* dedicatedAddTower_; 83 ConsoleCommand* dedicatedUpgradeTower_; 82 84 83 85 //TODO: void spawnNewWave() … … 94 96 TowerDefensePlayerStats *stats_; 95 97 bool hasEnoughCreditForTower(TowerCost towerCost); 98 bool hasEnoughCreditForUpgrade(); 96 99 97 100 std::vector<TowerTurret*> towers_; -
code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefenseEnemy.cc
r10151 r10158 42 42 SUPER(TowerDefenseEnemy, tick, dt); 43 43 44 //ArtificialController* controller = (ArtificialController*)this->getController(); 45 Vector3 ship = this->getRVWorldPosition(); 46 Vector3* endpoint = new Vector3(500, 700, 150); 47 48 float distance = ship.distance(*endpoint); 49 50 //orxout() << "distance" << distance << endl; 51 if(distance <50){ 52 orxout() << "ENEMY KILLED!!!!" << endl; 53 this->destroy(); } 44 54 } 45 55 -
code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefensePlayerStats.h
r10142 r10158 44 44 typedef enum _TowerCosts { 45 45 // Set to 0 for debug... 46 TDDefaultTowerCost = 20 46 TDDefaultTowerCost = 20 , 47 TDDefaultUpgradeCost = 15 47 48 } TowerCost; 48 49 … … 67 68 { waveNumber_++; } 68 69 70 inline void upgradeTower(int upgradecost) 71 { credit_ -= upgradecost;} 72 73 74 69 75 private: 70 76 int credit_; 71 77 int waveNumber_; 78 int upgradecost; 72 79 //int baseHealth_; 73 80 }; -
code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefenseTower.cc
r10142 r10158 27 27 28 28 this->setCollisionType(WorldEntity::Dynamic); 29 upgrade = 0; 29 30 30 31 //this->removeAllEngines(); … … 60 61 //orxout() << "rotateRoll" << ++roll << endl; 61 62 } 63 64 bool TowerDefenseTower::upgradeTower() 65 { 66 if(upgrade < 3) 67 { 68 upgrade++; 69 float reloadrate = getReloadRate(); 70 float reloadwaittime = getReloadWaitTime(); 71 this->setDamageMultiplier(5000); 72 73 reloadrate = 0.5*reloadrate; 74 reloadwaittime = 0.5*reloadwaittime; 75 setReloadRate(reloadrate); 76 setReloadWaitTime(reloadwaittime); 77 this->addTemplate("towerturret1"); 78 } 79 else 80 { 81 orxout() << "Tower fully upgraded" << endl; 82 return false; 83 } 84 return true; 85 } 62 86 63 87 // This function is called whenever a player presses the up or the down key. -
code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefenseTower.h
r10142 r10158 41 41 virtual void rotatePitch(const Vector2& value); 42 42 virtual void rotateRoll(const Vector2& value); 43 virtual bool upgradeTower(); 44 43 45 44 46 void setGame(TowerDefense* Towerdefense) … … 46 48 private: 47 49 TowerDefense* game_; 50 int upgrade; 48 51 }; 49 52 }
Note: See TracChangeset
for help on using the changeset viewer.