diff --git a/assets-cg/__pycache__/converters.cpython-310.pyc b/assets-cg/__pycache__/converters.cpython-310.pyc deleted file mode 100644 index c9120c5..0000000 Binary files a/assets-cg/__pycache__/converters.cpython-310.pyc and /dev/null differ diff --git a/src/boss.cpp b/src/boss.cpp index ed8773a..24cd8c1 100644 --- a/src/boss.cpp +++ b/src/boss.cpp @@ -100,7 +100,7 @@ Boss::Boss( int16_t _x, int16_t _y, uint8_t _id ) ID = _id; - speed = 10; + speed = 1; toberemoved = false; @@ -118,6 +118,8 @@ Boss::Boss( int16_t _x, int16_t _y, uint8_t _id ) life0 = 1000; } + hasTrajectory=false; + lastshoot0 = rtc_ticks(); lastshoot1 = rtc_ticks(); @@ -159,13 +161,21 @@ Boss::Boss( int16_t _x, int16_t _y, uint8_t _id ) Boss::~Boss() { - - + if (hasTrajectory) + delete(pathToFollow); } void Boss::Update( float dt ) { + + if (hasTrajectory) + { + pathToFollow->CalculatePosition( dt, speed, true, &x, &y ); + } + + + xmin = (int) x - width; xmax = (int) x + width; ymin = (int) y - height; @@ -228,7 +238,7 @@ void Boss::Update( float dt ) Vector2D shootDirection( MyPlayer->x - xGuns[i], MyPlayer->y - yGuns[i] ); shootDirection.Normalise(); - Bullet *b = new Bullet( (int) xGuns[i] , (int) yGuns[i], (int) shootDirection.x, (int) shootDirection.y, BULLET_ENEMY_RED ); + Bullet *b = new Bullet( xGuns[i] , yGuns[i], shootDirection.x, shootDirection.y, BULLET_ENEMY_RED ); MyEnemiesBullets.push_back( b ); hasExternalGun = true; @@ -411,7 +421,7 @@ bool Boss::Shoot_OK( uint32_t tempshoot, uint8_t shootID ) { if (shootID==BULLET_ENEMY_RED) { - if(tempshoot-lastshoot0>10) + if(tempshoot-lastshoot0>1) { lastshoot0=tempshoot; return true; @@ -420,7 +430,7 @@ bool Boss::Shoot_OK( uint32_t tempshoot, uint8_t shootID ) } else if (shootID==BULLET_ENEMY_GREEN) { - if(tempshoot-lastshoot1>25) + if(tempshoot-lastshoot1>1) { lastshoot1=tempshoot; return true; diff --git a/src/bullet.cpp b/src/bullet.cpp index bb5c375..6e3a207 100644 --- a/src/bullet.cpp +++ b/src/bullet.cpp @@ -56,6 +56,43 @@ Bullet::Bullet( uint16_t lx, uint16_t ly, int16_t dx, int16_t dy, uint8_t id ) toberemoved = false; } +Bullet::Bullet( libnum::num lx, libnum::num ly, libnum::num dx, libnum::num dy, uint8_t id ) +{ + x = lx; + y = ly; + + sx = dx; + sy = dy; + + ID=id; + + if (ID==BULLET_NORMAL) + { + strength = 5; + } + else if (ID==BULLET_BLUE) + { + strength = 2; + } + else if (ID==BULLET_LASER) + { + strength = 1; + } + else if (ID==BULLET_ENEMY_BLUE) + { + strength = 2; + } + else if (ID==BULLET_ENEMY_RED) + { + strength = 3; + } + else if (ID==BULLET_ENEMY_GREEN) + { + strength = 5; + } + toberemoved = false; +} + Bullet::~Bullet() { diff --git a/src/bullet.h b/src/bullet.h index 8ae9470..826290e 100644 --- a/src/bullet.h +++ b/src/bullet.h @@ -20,6 +20,7 @@ class Bullet { public: Bullet( uint16_t lx, uint16_t ly, int16_t dx, int16_t dy, uint8_t id ); + Bullet( libnum::num lx, libnum::num ly, libnum::num dx, libnum::num dy, uint8_t id ); ~Bullet(); void Update( float dt ); void Render(); diff --git a/src/main.cpp b/src/main.cpp index f788db2..1f0a2b5 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -489,6 +489,28 @@ int main(void) MyPlayer = new Player( azrp_width/4, azrp_height/2, 0); MyBoss = new Boss( 3*azrp_width/4, azrp_height/2, 0); + + + 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 ); + + MyBoss->hasTrajectory = true; + MyBoss->pathToFollow = MyTrajectory; + /* #if(DBGCRSH)