Commits

Mateo Imbrišak committed 183319a

Here's that bullet.
It can draw itself and move itself.

  • Participants
  • Parent commits 8ef85cf

Comments (0)

Files changed (2)

File gm_level.cpp

 #include "enemyship.h"
 #include "playership.h"
 #include "yellowenemyship.h"
+#include "bullet.h"
+
 
 extern bool gRunning;
 extern SDL_Surface * gScreen;
 {
     EnemyShip *enemyShip(new EnemyShip("enemyship01.png", 600, 400));
     EnemyShip *blueenemyShip(new EnemyShip("enemyship02.png", 800, 400));
-    this->enemyShips.push_back(enemyShip);
+    Bullet*bullet(new Bullet(150,200));
+    this->bullets.push_back(bullet);
+
+
+	this->enemyShips.push_back(enemyShip);
     this->enemyShips.push_back(blueenemyShip);
-    
-    
+
+
     for(int i = 0; i < 50; i++)
     {
         YellowEnemyShip *yellowEnemyShip(new YellowEnemyShip(320 + i * 60, 240));
         this->enemyShips.push_back(yellowEnemyShip);
     }
-    
+
     for(int i = 0; i < 50; i++)
     {
         YellowEnemyShip *yellowEnemyShip(new YellowEnemyShip(320 + i * 60, -240));
         this->enemyShips.push_back(yellowEnemyShip);
     }
-    
-    
+
+
     for(int i = 0; i < 50; i++)
     {
         YellowEnemyShip *yellowEnemyShip(new YellowEnemyShip(320 + i * 60, 120));
         this->enemyShips.push_back(yellowEnemyShip);
     }
-    
+
     for(int i = 0; i < 50; i++)
     {
         YellowEnemyShip *yellowEnemyShip(new YellowEnemyShip(320 + i * 60, -120));
     glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
     glMatrixMode(GL_PROJECTION);
     glLoadIdentity();
+
     gluOrtho2D(-320, 320, 240, -240);
 
     glMatrixMode(GL_MODELVIEW);
         (*it)->paintSelf();
     }
 
+
+    for(std::vector<Bullet*>::iterator it = bullets.begin(); it != bullets.end(); it++)
+    {
+        (*it)->paintSelf();
+    }
+
     SDL_GL_SwapBuffers();
 }
 
     {
         (*it)->updateSelf(timeDelta);
     }
+
+     for(std::vector<Bullet*>::iterator it = bullets.begin(); it != bullets.end(); it++)
+    {
+        (*it)->updateSelf(timeDelta);
+    }
 }
 #include "gamemode.h"
 #include "gameobject.h"
 #include "enemyship.h"
+#include "bullet.h"
 
 class PlayerShip;
 
     private:
     std::vector<GameObject*> gameObjects;
     std::vector<EnemyShip*> enemyShips;
+    std::vector<Bullet*> bullets;
     PlayerShip * playership;
 };