diff --git a/headers/pixelManager.h b/headers/pixelManager.h index 7310bb8..f51fcf3 100644 --- a/headers/pixelManager.h +++ b/headers/pixelManager.h @@ -1,5 +1,5 @@ -#ifndef GUARD_DRAWENGINE -#define GUARD_DRAWENGINE +#ifndef GUARD_PIXELMANAGER_H +#define GUARD_PIXELMANAGER_H #include "mingl/mingl.h" #include "mingl/shape/line.h" @@ -11,6 +11,9 @@ class PixelManager{ public: MinGL& window; + + nsGui::Sprite background = nsGui::Sprite("./assets/bg.sl2"); // you cant create an empty sprite for some reasons + explicit PixelManager(MinGL&); void drawInvader1(const nsGraphics::Vec2D& baseVector, unsigned size); void drawInvader2(const nsGraphics::Vec2D& baseVector, unsigned size); @@ -18,7 +21,6 @@ public: void drawPlayer(const nsGraphics::Vec2D& baseVector, unsigned width, const nsGraphics::RGBAcolor &color); void drawTorpedo(const nsGraphics::Vec2D& baseVector, unsigned width, const nsGraphics::RGBAcolor& color); void drawMissile(const nsGraphics::Vec2D& baseVector, unsigned width, const nsGraphics::RGBAcolor& color); - nsGui::Sprite background = nsGui::Sprite("./assets/bg.sl2", nsGraphics::Vec2D(0,0)); // you cant create an empty sprite for some reasons void drawBackground(); unsigned showInitialMenu(); diff --git a/src/gameManagers.cpp b/src/gameManagers.cpp index 8590a01..31fe5cd 100644 --- a/src/gameManagers.cpp +++ b/src/gameManagers.cpp @@ -147,7 +147,7 @@ bool Game::checkMissilesAndPlayers() { auto miss_ite = missiles.begin(); while(miss_ite!=missiles.end()){ bool wasColliding = false; - if(miss_ite->getY()<=PLAYER_HEIGHT){ // check collision on Y + if(miss_ite->getY()>=pm.getScreenHeight()-PLAYER_HEIGHT){ // check collision on Y // now check collision on X (with both players) for(Player& p : players){ if(areLinesColliding(