scene_loader.c
void DrawAllHealthBars(SceneData* scene_data, Canvas* game_canvas){
	// Iterate through each tank and if the tank is alive, draw a health bar over it
	
	int p1_tanks_total = scene_data[SCENE_GAME_MAP].player_1_tanks;
	int p2_tanks_total = scene_data[SCENE_GAME_MAP].player_2_tanks;

	for(int t = 0; t < p1_tanks_total; t++){
		Tank* temp_tank = &(scene_data[SCENE_GAME_MAP].player_1_tanks_obj[t]);
		
		if(temp_tank->is_alive == true){ // Is the tank alive?
			DrawSingleHealthBar(temp_tank, game_canvas);
		}
	}
	for(int t = 0; t < p2_tanks_total; t++){
		Tank* temp_tank = &(scene_data[SCENE_GAME_MAP].player_2_tanks_obj[t]);
		
		if(temp_tank->is_alive == true){ // Is the tank alive?
			// Draw health bar over that tank
			DrawSingleHealthBar(temp_tank, game_canvas);
		}
	}

	return;
}
/*  This function iterates through all the live tanks and call function 
	'DrawSingleHealthBar' to draw a health bar over them  */
This function iterates through all the live tanks and call function
'DrawSingleHealthBar' to draw a health bar over them
This function iterates through all the live tanks and call function ' DrawSingleHealthBar ' to draw a health bar over them
void DrawAllHealthBars(SceneData* scene_data, Canvas* game_canvas){
	int p1_tanks_total = scene_data[SCENE_GAME_MAP].player_1_tanks;
	int p2_tanks_total = scene_data[SCENE_GAME_MAP].player_2_tanks;
	for(int t = 0; t < p1_tanks_total; t++){
		Tank* temp_tank = &(scene_data[SCENE_GAME_MAP].player_1_tanks_obj[t]);
		if(temp_tank->is_alive == true){ 
			DrawSingleHealthBar(temp_tank, game_canvas);
		}
	}
	for(int t = 0; t < p2_tanks_total; t++){
		Tank* temp_tank = &(scene_data[SCENE_GAME_MAP].player_2_tanks_obj[t]);
		if(temp_tank->is_alive == true){ 
			DrawSingleHealthBar(temp_tank, game_canvas);
		}
	}
	return;
}
void DrawAllHealthBars ( SceneData * scene_data , Canvas * game_canvas ) { int p1_tanks_total = scene_data [ SCENE_GAME_MAP ] . player_1_tanks ; int p2_tanks_total = scene_data [ SCENE_GAME_MAP ] . player_2_tanks ; for ( int t = 0 ; t < p1_tanks_total ; t ++ ) { Tank * temp_tank = & ( scene_data [ SCENE_GAME_MAP ] . player_1_tanks_obj [ t ] ) ; if ( temp_tank -> is_alive == true ) { DrawSingleHealthBar ( temp_tank , game_canvas ) ; } } for ( int t = 0 ; t < p2_tanks_total ; t ++ ) { Tank * temp_tank = & ( scene_data [ SCENE_GAME_MAP ] . player_2_tanks_obj [ t ] ) ; if ( temp_tank -> is_alive == true ) { DrawSingleHealthBar ( temp_tank , game_canvas ) ; } } return ; }
This function iterates through all the live tanks and call function
'DrawSingleHealthBar' to draw a health bar over them
This function iterates through all the live tanks and call function ' DrawSingleHealthBar ' to draw a health bar over them
// Iterate through each tank and if the tank is alive, draw a health bar over it // Is the tank alive? // Is the tank alive? // Draw health bar over that tank