missiles are actually not dumb now
This commit is contained in:
		
							parent
							
								
									c6d3b022bc
								
							
						
					
					
						commit
						5b04846e7d
					
				| @ -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(); | ||||
|  | ||||
| @ -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( | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user