Changeset 9828 for code/branches/invaders
- Timestamp:
- Nov 25, 2013, 5:35:30 PM (11 years ago)
- Location:
- code/branches/invaders
- Files:
-
- 3 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/invaders/data/levels/Invaders.oxw
r9777 r9828 5 5 screenshot = "emptylevel.png" 6 6 /> 7 7 <!-- include("HUDTemplates3.oxo") --> 8 8 <?lua 9 9 include("stats.oxo") 10 include("HUDTemplates3.oxo")11 10 include("templates/lodInformation.oxt") 12 11 ?> … … 17 16 include("templates/spaceshipInvader.oxt") 18 17 include("templates/enemyInvader.oxt") 18 include("overlays/InvaderHUD.oxo") 19 19 ?> 20 20 … … 61 61 62 62 <MovableEntity 63 position = "<?lua print(math.random()* 30000 -1000) ?>,-1000,<?lua print(math.random() * 4000 - 2000) ?>"63 position = "<?lua print(math.random()* 40000 + 1000) ?>,-1000,<?lua print(math.random() * 4000 - 2000) ?>" 64 64 collisionType = dynamic 65 65 linearDamping = 0.8 -
code/branches/invaders/data/levels/templates/enemyInvader.oxt
r9793 r9828 34 34 35 35 collisionType = "dynamic" 36 mass = 536 mass = 0.00001 37 37 linearDamping = 0 38 38 angularDamping = 0 -
code/branches/invaders/data/levels/templates/spaceshipInvader.oxt
r9744 r9828 34 34 35 35 collisionType = "dynamic" 36 mass = 8036 mass = 4200000 37 37 linearDamping = 0.7 38 38 angularDamping = 0.9999999 39 40 collisiondamage = 100 41 enablecollisiondamage = true 39 42 > 40 43 <engines> -
code/branches/invaders/src/modules/invader/CMakeLists.txt
r9777 r9828 6 6 InvaderEnemy.cc 7 7 InvaderWeapon.cc 8 InvaderHUDinfo.cc 8 9 END_BUILD_UNIT 9 10 ) -
code/branches/invaders/src/modules/invader/Invader.cc
r9793 r9828 62 62 this->console_addEnemy = createConsoleCommand( "spawnEnemy", createExecutor( createFunctor(&Invader::spawnEnemy, this) ) ); 63 63 //this->context = context; 64 this->setHUDTemplate("InvaderHUD"); 64 65 65 66 enemySpawnTimer.setTimer(2.0f, true, createExecutor(createFunctor(&Invader::spawnEnemy, this))); … … 83 84 newPawn->addTemplate("enemyinvader"); 84 85 85 newPawn->setPosition(player->getPosition() + Vector3(1000, 0, 0)); 86 newPawn->setPosition(player->getPosition() + Vector3(1000, 0, 0)); // BUG: 86 87 } 87 88 -
code/branches/invaders/src/modules/invader/Invader.h
r9777 r9828 62 62 void setCenterpoint(InvaderCenterPoint* center) 63 63 { this->center_ = center; } 64 65 int getLives(){return this->lives;} 66 int getLevel(){return this->level;} 67 int getPoints(){return this->point;} 64 68 private: 65 69 WeakPtr<InvaderCenterPoint> center_; 66 InvaderShip *player;70 WeakPtr<InvaderShip> player; 67 71 68 72 ConsoleCommand* console_addEnemy; 69 70 73 Timer enemySpawnTimer; 71 74 //Context* context; 75 int lives; 76 int level; 77 int point; 72 78 }; 73 79 } -
code/branches/invaders/src/modules/invader/InvaderEnemy.cc
r9793 r9828 43 43 { 44 44 RegisterObject(InvaderEnemy); 45 enableCollisionCallback(); 45 46 } 46 47 … … 49 50 SUPER(InvaderEnemy, tick, dt); 50 51 } 52 53 inline bool InvaderEnemy::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint) 54 { 55 orxout() << "sadsadasfasf" << endl; 56 removeHealth(2000); 57 setVelocity(Vector3(0,0,1000)); 58 return false; 59 } 51 60 } -
code/branches/invaders/src/modules/invader/InvaderEnemy.h
r9793 r9828 48 48 49 49 virtual void tick(float dt); 50 virtual bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint); 50 51 51 52 private: -
code/branches/invaders/src/modules/invader/InvaderPrereqs.h
r9777 r9828 73 73 class InvaderEnemy; 74 74 class InvaderWeapon; 75 class InvaderHUDinfo; 75 76 } 76 77 -
code/branches/invaders/src/modules/invader/InvaderShip.cc
r9793 r9828 70 70 { 71 71 float dist_y = velocity.y * dt; 72 float dist_x = velocity.x * dt; 72 73 if(dist_y + posforeward > -42*3 && dist_y + posforeward < 42*6) 73 74 posforeward += dist_y; 74 75 else 75 76 velocity.y = 0; 77 if (pos.z + dist_x > 42*2.5 || pos.z + dist_x < -42*3) 78 velocity.x = 0; 76 79 // this->setVelocity(Vector3(1000 + velocity.y, 0, velocity.x)); 77 80 pos += Vector3(1000 + velocity.y, 0, velocity.x) * dt; … … 93 96 94 97 // bring back on track! 95 if (pos.z > 42*2.5)96 pos.z = 42*2.5;97 else if (pos.z < -42*3)98 pos.z = -42*3;98 // if (pos.z > 42*2.5) 99 // pos.z = 42*2.5; 100 // else if (pos.z < -42*3) 101 // pos.z = -42*3; 99 102 if(pos.y != 0) 100 103 pos.y = 0; 101 // if (camera != NULL)102 // {103 // float x = camera->getWorldPosition().x;104 // if (pos.x > x + 20)105 // pos.x = x + 20;106 // else if (pos.x < x - 20)107 // pos.x = x - 20;108 // }109 // if (abs(posforeward) < 20)110 104 111 105 … … 114 108 115 109 // Level up! 116 if (pos.x > 30000)110 if (pos.x > 42000) 117 111 { 118 112 updateLevel(); 119 setPosition(Vector3(0, 0, 0)); // pos - Vector3(30000, 0, 0)113 setPosition(Vector3(0, 0, pos.z)); // pos - Vector3(30000, 0, 0) 120 114 } 121 115 … … 144 138 isFireing = bBoost; 145 139 } 140 inline bool InvaderShip::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint) 141 { 142 // orxout() << "touch!!! " << endl; //<< otherObject << " at " << contactPoint; 143 144 WeakPtr<InvaderEnemy> enemy = orxonox_cast<InvaderEnemy*>(otherObject); 145 if (enemy != NULL && lastEnemy != enemy) 146 { 147 lastEnemy = enemy; 148 orxout() << "Enemy!!!! " << endl; 149 removeHealth(20); 150 if (getHealth() <= 0) 151 { 152 orxout() << "DIED!!!! " << endl; 153 } 154 return false; 155 } 156 return false; 157 // SUPER(InvaderShip, collidesAgainst, otherObject, contactPoint); 158 } 146 159 } -
code/branches/invaders/src/modules/invader/InvaderShip.h
r9793 r9828 63 63 64 64 // *InvaderShip getShip(){return this;} 65 virtual inline bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint); 65 66 private: 66 67 Camera* camera; … … 74 75 } velocity, desiredVelocity; 75 76 77 WeakPtr<InvaderEnemy> lastEnemy; 78 76 79 }; 77 80 }
Note: See TracChangeset
for help on using the changeset viewer.