EN_Conductor = EN_Root; while(true) { Enemy_dest.X = (int)Player.X; Enemy_dest.Y = (int)Player.Y; //Checks if player has collided with Monster if ( Calc_hits( EN_Conductor->Info, Player) == 1 ) { Enemy_node *EN_Temp; EN_Temp = EN_Root; if(EN_Root->Next!=NULL) { EN_Temp=EN_Temp->Next; } EN_Conductor=EN_Temp; while( EN_Temp->Next != NULL) { EN_Temp = EN_Temp->Next; delete EN_Conductor; EN_Conductor = EN_Temp; } EN_Conductor=EN_Root; //Sets A new spawning place for monster EN_Conductor->Info.X = rand()%(640 - EN_Conductor->Info.X_size); EN_Conductor->Info.Y = rand()%(480 - EN_Conductor->Info.Y_size); Score =0; } //Checks if weapon has hit Monster if( Calc_hits( Weapon, EN_Conductor->Info ) == 1 ) { //Sets the que for a new monster to be added to game E_Waiting_creation++; //Sets splatter on screen apply_surface( (int)EN_Conductor->Info.X, (int)EN_Conductor->Info.Y, Dead_monster, Background); //Spawns the existing monster again EN_Conductor->Info.X = rand()%(640 - EN_Conductor->Info.X_size); EN_Conductor->Info.Y = rand()%(480 - EN_Conductor->Info.Y_size); Totalscore++; Score++; } //Moves the monster Calc_Box_Dest( EN_Conductor->Info, Enemy_dest); Calc_Box_location(EN_Conductor->Info); //Applies the monsters image to screen apply_surface((int)EN_Conductor->Info.X,(int)EN_Conductor->Info.Y, Monster, Screen ); //Breaks if there is no next node if( EN_Conductor->Next == NULL ) { break;} //Goes to next node EN_Conductor = EN_Conductor->Next; } //Loop runs if there is a line of monsters to be spawned EN_Conductor = EN_Root; while( E_Waiting_creation > 0) { //Adds a new monster if we are in the end of the linked list if(EN_Conductor->Next == NULL) { //Makes new node EN_Conductor->Next = new Enemy_node; //Goes to new node EN_Conductor = EN_Conductor->Next; EN_Conductor->Next = NULL; //Sets Monster coordinates EN_Conductor->Info.X = rand()%(640 - EN_Conductor->Info.X_size); EN_Conductor->Info.Y = rand()%(480 - EN_Conductor->Info.Y_size); EN_Conductor->Info.Speed=0.2; //reduces the monster from the number of monsters needed to spawn E_Waiting_creation--; } //Goes forward in the linked list if(EN_Conductor->Next != NULL) { EN_Conductor = EN_Conductor->Next; } }