Changeset 9854 for code/branches/invaders
- Timestamp:
- Dec 2, 2013, 3:53:08 PM (11 years ago)
- Location:
- code/branches/invaders
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/invaders/data/levels/templates/enemyInvader.oxt
r9828 r9854 7 7 explosionchunks = 4 8 8 9 health = 1 10 maxhealth = 1 11 initialhealth = 1 9 health = 100 10 maxhealth = 100 11 initialhealth = 100 12 12 13 13 shieldhealth = 35 … … 46 46 </engines> 47 47 <attached> 48 <Model position="0,0,0" yaw= 90 pitch=0 roll=0 scale=8 mesh="escortShip.mesh" />49 <Model position="0,0,0" yaw=180 pitch= 90 roll=0 scale=8mesh="escortWeapon.mesh" />48 <Model position="0,0,0" yaw=180 pitch=270 roll=0 scale=2 mesh="swallow_mat.mesh" /> 49 <Model position="0,0,0" yaw=180 pitch=270 roll=0 scale=2 mesh="escortWeapon.mesh" /> 50 50 <!--Model mesh="cube.mesh" mass=10 position="0,0,3" scale3D="10,4,8" /> 51 52 swallow_mat.mesh 53 "ghost.mesh" 54 51 55 <Model mesh="cube.mesh" mass=10 position="12.6,-2,3" scale3D="2.8,2.8,11" /> 52 56 <Model mesh="cube.mesh" mass=10 position="-12.6,-2,3" scale3D="2.8,2.8,11" /> -
code/branches/invaders/data/overlays/InvaderHUD.oxo
r9829 r9854 68 68 showpoints = true 69 69 /> 70 71 72 <OverlayText 73 position = "0.4, 0.1" 74 pickpoint = "0.0, 0.0" 75 font = "ShareTechMono" 76 textsize = 0.04 77 colour = "1.0, 1.0, 1.0, 1.0" 78 align = "left" 79 caption = "X" 80 /> 81 <InvaderHUDinfo 82 position = "0.42, 0.1" 83 pickpoint = "0.0, 0.0" 84 font = "ShareTechMono" 85 textsize = 0.04 86 colour = "1.0, 1.0, 1.0, 1.0" 87 align = "left" 88 89 showMultiplier = true 90 /> 70 91 </OverlayGroup> 71 92 </Template> -
code/branches/invaders/src/modules/invader/Invader.cc
r9837 r9854 87 87 return; 88 88 89 for (int i = 0; i < level; i++) 89 srand(player->getPosition().x + player->getPosition().y); 90 for (int i = 0; i < level * 2; i++) 90 91 { 91 SmartPtr<InvaderEnemy> newPawn = new InvaderEnemy(this->center_->getContext());92 WeakPtr<InvaderEnemy> newPawn = new InvaderEnemy(this->center_->getContext()); 92 93 newPawn->addTemplate("enemyinvader"); 93 newPawn->setPosition(player->getPosition() + Vector3(500 + 100 * i, 0, 0)); 94 newPawn->setPlayer(player); 95 newPawn->level = level; 96 newPawn->setPosition(player->getPosition() + Vector3(500 + 100 * i, 0, float(rand())/RAND_MAX * 400 - 200)); 94 97 } 95 98 } -
code/branches/invaders/src/modules/invader/Invader.h
r9837 r9854 66 66 int getLevel(){return this->level;} 67 67 int getPoints(){return this->point;} 68 int getMultiplier(){return this->multiplier;} 68 69 69 70 void costLife(){lives--; if (lives <= 0) end();}; -
code/branches/invaders/src/modules/invader/InvaderEnemy.cc
r9837 r9854 44 44 RegisterObject(InvaderEnemy); 45 45 enableCollisionCallback(); 46 lifetime = 0; 46 47 } 47 48 48 49 void InvaderEnemy::tick(float dt) 49 50 { 50 setVelocity(Vector3(500 ,0, 0)); 51 lifetime += dt; 52 if (lifetime > 5000) 53 { 54 removeHealth(2000); 55 } 56 if (player != NULL) 57 { 58 float newZ = player->getPosition().z - getPosition().z; 59 if (newZ < 0) 60 newZ = (-100 < newZ)?-100:newZ; 61 else 62 newZ = (100 > newZ)?100:newZ; 63 setVelocity(Vector3(1000 - level * 100 , 0, newZ)); 64 } 51 65 SUPER(InvaderEnemy, tick, dt); 52 66 } … … 54 68 inline bool InvaderEnemy::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint) 55 69 { 56 setVelocity(Vector3( 900,0,0));70 setVelocity(Vector3(1000,0,0)); 57 71 removeHealth(2000); 58 72 return false; -
code/branches/invaders/src/modules/invader/InvaderEnemy.h
r9829 r9854 50 50 virtual bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint); 51 51 virtual void damage(float damage, float healthdamage, float shielddamage, Pawn* originator); 52 virtual void setPlayer(WeakPtr<InvaderShip> player){this->player = player;} 52 53 54 int level; 53 55 private: 54 56 WeakPtr<Invader> getGame(); 55 57 WeakPtr<Invader> game; 58 WeakPtr<InvaderShip> player; 56 59 Camera* camera; 57 60 bool isFireing; 58 61 float speed, damping; 59 62 float lastTimeFront, lastTimeLeft; 63 float lifetime; 60 64 struct Velocity 61 65 { -
code/branches/invaders/src/modules/invader/InvaderHUDinfo.cc
r9828 r9854 44 44 this->bShowLevel_ = false; 45 45 this->bShowPoints_ = false; 46 this->bShowMultiplier_ = false; 46 47 } 47 48 … … 57 58 XMLPortParam(InvaderHUDinfo, "showPoints", setShowPoints, getShowPoints, xmlelement, mode).defaultValues(false); 58 59 XMLPortParam(InvaderHUDinfo, "showLevel", setShowLevel, getShowLevel, xmlelement, mode).defaultValues(false); 60 XMLPortParam(InvaderHUDinfo, "showMultiplier", setShowMultiplier, getShowMultiplier, xmlelement, mode).defaultValues(false); 59 61 } 60 62 … … 80 82 this->setCaption(points); 81 83 } 84 else if(this->bShowMultiplier_) 85 { 86 const std::string& Multiplier = multi_cast<std::string>(this->InvaderGame->getMultiplier()); 87 this->setCaption(Multiplier); 88 } 82 89 } 83 90 } -
code/branches/invaders/src/modules/invader/InvaderHUDinfo.h
r9828 r9854 60 60 { return this->bShowPoints_; } 61 61 62 inline void setShowMultiplier(bool value) 63 { this->bShowMultiplier_ = value; } 64 inline bool getShowMultiplier() const 65 { return this->bShowMultiplier_; } 66 67 62 68 private: 63 69 Invader* InvaderGame; … … 65 71 bool bShowLevel_; 66 72 bool bShowPoints_; 73 bool bShowMultiplier_; 67 74 }; 68 75 }
Note: See TracChangeset
for help on using the changeset viewer.