#include "collections.h" #include #include extern std::vector MyParticles; extern std::vector MyPlayerBullets; extern std::vector MyEnemiesBullets; extern std::vector MyEnemies; extern std::vector MyImpacts; extern Player *MyPlayer; void Create_Player_Shoot( uint8_t id ) { if (id==BULLET_NORMAL) { Bullet *b = new Bullet( (int) MyPlayer->x+21, (int) MyPlayer->y, 6, 0, id ); MyPlayerBullets.push_back( b ); } else if (id==BULLET_BLUE) { Bullet *b1 = new Bullet( (int) MyPlayer->x, (int) MyPlayer->y-17, 5, 0, id ); MyPlayerBullets.push_back( b1 ); Bullet *b2 = new Bullet( (int) MyPlayer->x, (int) MyPlayer->y+17, 5, 0, id ); MyPlayerBullets.push_back( b2 ); } else if (id==BULLET_LASER) { Bullet *b1 = new Bullet( (int) MyPlayer->x+21, (int) MyPlayer->y, 3, 0, id ); MyPlayerBullets.push_back( b1 ); Bullet *b2 = new Bullet( (int) MyPlayer->x, (int) MyPlayer->y-17, 3, 0, id ); MyPlayerBullets.push_back( b2 ); Bullet *b3 = new Bullet( (int) MyPlayer->x, (int) MyPlayer->y+17, 3, 0, id ); MyPlayerBullets.push_back( b3 ); } } void Create_Enemies( void ) { Enemy* e1 = new Enemy( 348, 112, 0); e1->Set_Speed_Vector( 1, 1, -6 ); MyEnemies.push_back( e1 ); Enemy* e2 = new Enemy( 348, 112, 0); e2->Set_Speed_Vector( 1, 1, 6 ); MyEnemies.push_back( e2 ); Enemy* e3 = new Enemy( 348, 112, 1); e3->Set_Speed_Vector( 1, 3, -3 ); MyEnemies.push_back( e3 ); Enemy* e4 = new Enemy( 348, 112, 1); e4->Set_Speed_Vector( 1, 3, 3 ); MyEnemies.push_back( e4 ); Point2D *A = new Point2D( 348, 112 ); Point2D *B = new Point2D( 371, 199 ); Point2D *C = new Point2D( 198, 149 ); Point2D *D = new Point2D( 25, 199 ); Point2D *E = new Point2D( 25, 25 ); Point2D *F = new Point2D( 198, 75 ); Point2D *G = new Point2D( 371, 25 ); Trajectory *MyTrajectory= new Trajectory(); MyTrajectory->AddPoint( A ); MyTrajectory->AddPoint( B ); MyTrajectory->AddPoint( C ); MyTrajectory->AddPoint( D ); MyTrajectory->AddPoint( E ); MyTrajectory->AddPoint( F ); MyTrajectory->AddPoint( G ); Enemy* e5 = new Enemy( 348, 112, 2); e5->hasTrajectory = true; e5->pathToFollow = MyTrajectory; MyEnemies.push_back( e5 ); } void Create_Explosion( uint16_t xexplosion, uint16_t yexplosion ) { srand(rtc_ticks()); for(int i=0; i<=50; i++) { Particle *p = new Particle( xexplosion, yexplosion, i ); MyParticles.push_back( p ); } } void Create_Impact( uint16_t ximpact, uint16_t yimpact ) { Impact *i = new Impact( ximpact, yimpact ); MyImpacts.push_back( i ); } void Clean_Everything( void ) { for(unsigned int i=0; i