Browse Source

Merge branch 'fix_boss_bullet_interaction' of jp/invaders into master

blue 4 years ago
parent
commit
e0adbcdad9
1 changed files with 2 additions and 2 deletions
  1. 2 2
      functions.cpp

+ 2 - 2
functions.cpp

@@ -965,7 +965,7 @@ void interactions(player& player1,b_list& bullets,b_list& bombs,e_list& enemies,
 		
 		
 			
-		if((it1->x>=boss1.x+boss1.width/2-2 && it1->x<=boss1.x+boss1.width/2+2) && boss1.alive){	//bullet+boss
+		if((it1->x>=boss1.x+boss1.width/2-2 && it1->x<=boss1.x+boss1.width/2+2) && it1->y<=boss1.y+boss1.height && boss1.alive){	//bullet+boss
 				boss1.health--;
 				if(it1->y==boss1.y) it1=bullets.erase(it1);	//bullet gets destroyed only when has reached boss's top
 		        	else
@@ -1019,7 +1019,7 @@ void interactions(player& player1,b_list& bullets,b_list& bombs,e_list& enemies,
 		}
 		if(should_continue) continue;
 		
-		if((itr->x>=boss1.x+boss1.width/2-2 && itr->x<=boss1.x+boss1.width/2+2) && boss1.alive) 	//rocket+boss
+		if((itr->x>=boss1.x+boss1.width/2-2 && itr->x<=boss1.x+boss1.width/2+2) && itr->y<=boss1.y+boss1.height && boss1.alive) 	//rocket+boss
 		{
 			boss1.health--;
 			if(itr->y==boss1.y)