#include "enemy.hpp"

enemy :: enemy(){

	Triggered = false;

	TriggerSound = Mix_LoadWAV( "sounds/trigger.wav" );
	MDamageSound = Mix_LoadWAV( "sounds/mdamage2.wav" );
	MDieSound = Mix_LoadWAV( "sounds/mdie2.wav" );
	RDamageSound = Mix_LoadWAV( "sounds/rdamage.wav" );

	EnemySheet1 = load_image( "characters/enemy1.png" );
	EnemySheet2 = load_image( "characters/enemy2.png" );
	EnemySheet3 = load_image( "characters/enemy3.png" );
	EnemySheet4 = load_image( "characters/enemy4.png" );
	EnemySheet5 = load_image( "characters/enemy5.png" );
	EnemySheet6 = load_image( "characters/enemy6.png" );
	DamageSheet = load_image( "characters/damage.png" );
	MDamageSheet = load_image( "characters/mdamage.png" );
	BirthSheet = load_image( "characters/mbirth.png" );

	SDL_SetAlpha( EnemySheet1, SDL_SRCALPHA, 65 );
	SDL_SetAlpha( EnemySheet2, SDL_SRCALPHA, 65 );
	SDL_SetAlpha( EnemySheet3, SDL_SRCALPHA, 65 );
	SDL_SetAlpha( EnemySheet4, SDL_SRCALPHA, 65 );
	SDL_SetAlpha( EnemySheet5, SDL_SRCALPHA, 65 );
	SDL_SetAlpha( EnemySheet6, SDL_SRCALPHA, 65 );
	SDL_SetAlpha( DamageSheet, SDL_SRCALPHA, 85 );
	SDL_SetAlpha( MDamageSheet, SDL_SRCALPHA, 110 );
	SDL_SetAlpha( BirthSheet, SDL_SRCALPHA, 110 );

	Frame = 0;
	DFrame = 0;


	Damaged = false;
	DamageCounter = 0;


	for( int i = 0; i < 4; i++ )
		for( int j = 0; j < 4; j++ ){

			Offsets[ i ][ j ].x = j * WIDTH;
			Offsets[ i ][ j ].y = i * HEIGHT;
			Offsets[ i ][ j ].w = WIDTH;
			Offsets[ i ][ j ].h = HEIGHT;

		}

	for( int i = 0; i < 4; i++ ){
		DOffsets[ i ].x = i * WIDTH;
		DOffsets[ i ].y = 0;
		DOffsets[ i ].w = WIDTH;
		DOffsets[ i ].h = HEIGHT;
	}

	for( int i = 0; i < EnemyNumber; i++ ){
		TriggerOn[ i ] = true;
	}

	Triggers[ 0 ].x = 800;
	Triggers[ 0 ].y = 950;
	Triggers[ 0 ].w = 200;
	Triggers[ 0 ].h = 360;

	Triggers[ 1 ].x = 2600;
	Triggers[ 1 ].y = 590;
	Triggers[ 1 ].w = 800;
	Triggers[ 1 ].h = 480;

	Triggers[ 2 ].x = 6000;
	Triggers[ 2 ].y = 470;
	Triggers[ 2 ].w = 1000;
	Triggers[ 2 ].h = 600;

	Triggers[ 3 ].x = 4600;
	Triggers[ 3 ].y = 1070;
	Triggers[ 3 ].w = 1000;
	Triggers[ 3 ].h = 480;

	Triggers[ 4 ].x = 7800;
	Triggers[ 4 ].y = 950;
	Triggers[ 4 ].w = 1400;
	Triggers[ 4 ].h = 600;

	Triggers[ 5 ].x = 7200;
	Triggers[ 5 ].y = 2510;
	Triggers[ 5 ].w = 600;
	Triggers[ 5 ].h = 480;

	Triggers[ 6 ].x = 4600;
	Triggers[ 6 ].y = 2750;
	Triggers[ 6 ].w = 600;
	Triggers[ 6 ].h = 720;

	Triggers[ 7 ].x = 2400;
	Triggers[ 7 ].y = 2990;
	Triggers[ 7 ].w = 1200;
	Triggers[ 7 ].h = 720;

	Triggers[ 8 ].x = 0;
	Triggers[ 8 ].y = 2390;
	Triggers[ 8 ].w = 600;
	Triggers[ 8 ].h = 840;

	Triggers[ 9 ].x = 4400;
	Triggers[ 9 ].y = 4430;
	Triggers[ 9 ].w = 800;
	Triggers[ 9 ].h = 480;

	Triggers[ 10 ].x = 800;
	Triggers[ 10 ].y = 4670;
	Triggers[ 10 ].w = 800;
	Triggers[ 10 ].h = 480;

	Triggers[ 11 ].x = 8400;
	Triggers[ 11 ].y = 5510;
	Triggers[ 11 ].w = 800;
	Triggers[ 11 ].h = 600;

	Triggers[ 12 ].x = 5400;
	Triggers[ 12 ].y = 5390;
	Triggers[ 12 ].w = 1200;
	Triggers[ 12 ].h = 480;

	Triggers[ 13 ].x = 2400;
	Triggers[ 13 ].y = 5510;
	Triggers[ 13 ].w = 1400;
	Triggers[ 13 ].h = 600;

	Triggers[ 14 ].x = 2200;
	Triggers[ 14 ].y = 1670;
	Triggers[ 14 ].w = 800;
	Triggers[ 14 ].h = 360;

	Triggers[ 15 ].x = 6800;
	Triggers[ 15 ].y = 3590;
	Triggers[ 15 ].w = 1600;
	Triggers[ 15 ].h = 360;

	Triggers[ 16 ].x = 8600;
	Triggers[ 16 ].y = 4310;
	Triggers[ 16 ].w = 1200;
	Triggers[ 16 ].h = 480;

	Triggers[ 17 ].x = 800;
	Triggers[ 17 ].y = 3710;
	Triggers[ 17 ].w = 800;
	Triggers[ 17 ].h = 480;

	Triggers[ 18 ].x = 5800;
	Triggers[ 18 ].y = 1910;
	Triggers[ 18 ].w = 400;
	Triggers[ 18 ].h = 240;

	Triggers[ 19 ].x = 5600;
	Triggers[ 19 ].y = 3470;
	Triggers[ 19 ].w = 400;
	Triggers[ 19 ].h = 240;

	Triggers[ 20 ].x = 200;
	Triggers[ 20 ].y = 5750;
	Triggers[ 20 ].w = 800;
	Triggers[ 20 ].h = 360;

	Triggers[ 21 ].x = 7000;
	Triggers[ 21 ].y = 4910;
	Triggers[ 21 ].w = 1000;
	Triggers[ 21 ].h = 120;

	Triggers[ 22 ].x = 4000;
	Triggers[ 22 ].y = 1430;
	Triggers[ 22 ].w = 200;
	Triggers[ 22 ].h = 600;

	Triggers[ 23 ].x = 2800;
	Triggers[ 23 ].y = 4190;
	Triggers[ 23 ].w = 800;
	Triggers[ 23 ].h = 240;

	//temp moving triggers
	for( int i = 0; i < EnemyNumber; i++ )
		Triggers[ i ].y -= 100;


	//FILLING ENEMIES
	fill_enemy();

}

enemy :: ~enemy(){

	SDL_FreeSurface( EnemySheet1 );
	SDL_FreeSurface( EnemySheet2 );
	SDL_FreeSurface( EnemySheet3 );
	SDL_FreeSurface( EnemySheet4 );
	SDL_FreeSurface( EnemySheet5 );
	SDL_FreeSurface( EnemySheet6 );
	SDL_FreeSurface( DamageSheet );
	SDL_FreeSurface( MDamageSheet );
	SDL_FreeSurface( BirthSheet );

	Mix_FreeChunk( TriggerSound );
	Mix_FreeChunk( MDamageSound );
	Mix_FreeChunk( MDieSound );
	Mix_FreeChunk( RDamageSound );

}

void enemy :: move( int xVel, int yVel, bool collision, int& HP, bool isExtraLightOn, bool Difficulty ){

	SDL_Rect RHHitbox;
	SDL_Rect hitbox;

	RHHitbox.x = 410;
	RHHitbox.y = 310;
	RHHitbox.w = 10;
	RHHitbox.h = 30;

	SDL_Rect lighthitbox1, lighthitbox2;

	lighthitbox1.x = 200;
	lighthitbox1.y = 275;
	lighthitbox1.w = 420;
	lighthitbox1.h = 110;

	lighthitbox2.x = 305;
	lighthitbox2.y = 225;
	lighthitbox2.w = 207;
	lighthitbox2.h = 215;

	for( int i = 0; i < EnemyNumber; i++ ){

		if( !collision ){
			Triggers[ i ].x -= xVel;
			Triggers[ i ].y -= yVel;
		}
		if( check_collision( RHHitbox, Triggers[ i ] ) ){
			if( TriggerOn[ i ] ){
				Mix_HaltChannel( 7 );
				Mix_PlayChannel( 7, TriggerSound, 0 );
			}
			TriggerOn[ i ] = false;
			Triggered = true;
		}

		if( TriggerOn[ i ] == false ){

			for( int j = 0; j < 10; j++ ){
				if( EnemyData[ i ][ j ].birthcounter < 16 && EnemyData[ i ][ j ].type != NoEnemy ){

					EnemyData[ i ][ j ].birthcounter++;
					EnemyData[ i ][ j ].Coord.x -= xVel;
					EnemyData[ i ][ j ].Coord.y -= yVel;
					EnemyData[ i ][ j ].Coord2.x -= xVel;
					EnemyData[ i ][ j ].Coord2.y -= yVel;

				}
				if( EnemyData[ i ][ j ].HP > 0 && EnemyData[ i ][ j ].type != NoEnemy ){

					if( EnemyData[ i ][ j ].HP > 0 && EnemyData[ i ][ j ].birthcounter == 16 ){


						EnemyData[ i ][ j ].Coord.x -= xVel;
						EnemyData[ i ][ j ].Coord.y -= yVel;
						EnemyData[ i ][ j ].Coord2.x -= xVel;
						EnemyData[ i ][ j ].Coord2.y -= yVel;


						//Attacking Moves

						int Velocity;

						switch( EnemyData[ i ][ j ].type ){
							case NoEnemy : Velocity = 0; break;
							case EasyEnemy : Velocity = EasyVelocity; break;
							case NormalEnemy : Velocity = NormalVelocity; break;
							case HardEnemy : Velocity = HardVelocity; break;
							case Easy2Enemy : Velocity = Easy2Velocity; break;
							case Normal2Enemy : Velocity = Normal2Velocity; break;
							case Hard2Enemy : Velocity = Hard2Velocity; break;
						}

						hitbox.x = EnemyData[ i ][ j ].Coord.x + 35;
						hitbox.y = EnemyData[ i ][ j ].Coord.y + 20;
						hitbox.w = 14;
						hitbox.h = 20;

						if( isExtraLightOn )
							if( check_collision( lighthitbox1, hitbox ) || check_collision( lighthitbox2, hitbox ) ){
								EnemyData[ i ][ j ].HP -= Difficulty ? 3 : 1;

								if( EnemyData[ i ][ j ].HP <= 0 ){
									if( !EnemyData[ i ][ j ].dead )
										Mix_PlayChannel( 5, MDieSound, 0 );
									EnemyData[ i ][ j ].dead = true;
								}

								if( !Mix_Playing( 6 ) )
									Mix_PlayChannel( 6, MDamageSound, 0 );
							}

						if( EnemyData[ i ][ j ].HP <= 0 ) EnemyData[ i ][ j ].birthcounter = 0;

						if( EnemyData[ i ][ j ].type != NoEnemy && check_collision( hitbox, RHHitbox ) &&
							( EnemyData[ i ][ j ].Coord.x == EnemyData[ i ][ j ].Coord2.x &&
							EnemyData[ i ][ j ].Coord.y == EnemyData[ i ][ j ].Coord2.y ) ){

							if( rand() % 2 ){
								EnemyData[ i ][ j ].Coord2.x += 50 * Velocity;
							}
							else{
								EnemyData[ i ][ j ].Coord2.x -= 50 * Velocity;
							}

							if( rand() % 2 ){
								EnemyData[ i ][ j ].Coord2.y += 50 * Velocity;
							}
							else{
								EnemyData[ i ][ j ].Coord2.y -= 50 * Velocity;
							}

							Damaged = true;
							DamageCounter = 0;
							if( HP > 0 ) Difficulty ? HP -= 3 : HP -= 8;
							Mix_PlayChannel( -1, RDamageSound, 0 );
						}

						if( EnemyData[ i ][ j ].Coord.x == EnemyData[ i ][ j ].Coord2.x &&
							EnemyData[ i ][ j ].Coord.y == EnemyData[ i ][ j ].Coord2.y ){

								if( EnemyData[ i ][ j ].Coord.y < 290 ){
									EnemyData[ i ][ j ].Coord.y += Velocity;
									EnemyData[ i ][ j ].Coord2.y = EnemyData[ i ][ j ].Coord.y;
									EnemyData[ i ][ j ].status = DOWN;
								}
								if( EnemyData[ i ][ j ].Coord.y > 290 ){
									EnemyData[ i ][ j ].Coord.y -= Velocity;
									EnemyData[ i ][ j ].Coord2.y = EnemyData[ i ][ j ].Coord.y;
									EnemyData[ i ][ j ].status = UP;
								}
								if( EnemyData[ i ][ j ].Coord.x < 365 - Velocity ){
									EnemyData[ i ][ j ].Coord.x += Velocity;
									EnemyData[ i ][ j ].Coord2.x = EnemyData[ i ][ j ].Coord.x;
									EnemyData[ i ][ j ].status = RIGHT;
								}
								if( EnemyData[ i ][ j ].Coord.x > 365 + Velocity ){
									EnemyData[ i ][ j ].Coord.x -= Velocity;
									EnemyData[ i ][ j ].Coord2.x = EnemyData[ i ][ j ].Coord.x;
									EnemyData[ i ][ j ].status = LEFT;
								}

						}
						else{

							Velocity *= 2;

							if( EnemyData[ i ][ j ].Coord.y < EnemyData[ i ][ j ].Coord2.y ){
								EnemyData[ i ][ j ].Coord.y += Velocity;
								EnemyData[ i ][ j ].status = DOWN;
							}
							if( EnemyData[ i ][ j ].Coord.y > EnemyData[ i ][ j ].Coord2.y ){
								EnemyData[ i ][ j ].Coord.y -= Velocity;
								EnemyData[ i ][ j ].status = UP;
							}
							if( EnemyData[ i ][ j ].Coord.x < EnemyData[ i ][ j ].Coord2.x ){
								EnemyData[ i ][ j ].Coord.x += Velocity;
								EnemyData[ i ][ j ].status = RIGHT;
							}
							if( EnemyData[ i ][ j ].Coord.x > EnemyData[ i ][ j ].Coord2.x ){
								EnemyData[ i ][ j ].Coord.x -= Velocity;
								EnemyData[ i ][ j ].status = LEFT;
							}

						}

					}
				}
			}


		}

	}

}

void enemy :: show( SDL_Surface* & screen, bool isLight, bool isExtraLight ){

	Frame++;
	if( Frame >= 15  )Frame = 0;
	DFrame++;
	if( DFrame >= 8 )DFrame = 0;

	SDL_Rect hitbox;

	SDL_Rect lighthitbox1, lighthitbox2;

	lighthitbox1.x = 200;
	lighthitbox1.y = 275;
	lighthitbox1.w = 420;
	lighthitbox1.h = 110;

	lighthitbox2.x = 305;
	lighthitbox2.y = 225;
	lighthitbox2.w = 207;
	lighthitbox2.h = 215;

	for( int i = 0; i < EnemyNumber; i++ ){


		if( TriggerOn[ i ] == false ){

			for( int j = 0; j < 10; j++ ){

				if( EnemyData[ i ][ j ].birthcounter < 16 && EnemyData[ i ][ j ].type != NoEnemy )
					apply_surface( EnemyData[ i ][ j ].Coord.x, EnemyData[ i ][ j ].Coord.y, BirthSheet, screen, &DOffsets[ EnemyData[ i ][ j ].birthcounter / 4 ] );


				if( EnemyData[ i ][ j ].type != NoEnemy && EnemyData[ i ][ j ].HP > 0 ){

					if( EnemyData[ i ][ j ].birthcounter == 16 ){
						hitbox.x = EnemyData[ i ][ j ].Coord.x + 35;
						hitbox.y = EnemyData[ i ][ j ].Coord.y + 20;
						hitbox.w = 14;
						hitbox.h = 20;

						apply_surface( EnemyData[ i ][ j ].Coord.x, EnemyData[ i ][ j ].Coord.y,
								EnemyData[ i ][ j ].type == EasyEnemy ? EnemySheet1 :
								EnemyData[ i ][ j ].type == Easy2Enemy ? EnemySheet2 :
								EnemyData[ i ][ j ].type == NormalEnemy ? EnemySheet3 :
								EnemyData[ i ][ j ].type == Normal2Enemy ? EnemySheet4 :
								EnemyData[ i ][ j ].type == HardEnemy ? EnemySheet5 :
								EnemySheet6
								,screen, &Offsets[ EnemyData[ i ][ j ].status ][ Frame / 4 ] );

						if( ( check_collision( lighthitbox1, hitbox ) || check_collision( lighthitbox2, hitbox ) ) && isLight && isExtraLight ){
							apply_surface( EnemyData[ i ][ j ].Coord.x, EnemyData[ i ][ j ].Coord.y, MDamageSheet, screen, &DOffsets[ DFrame / 2 ] );
						}
					}

				}

			}

		}

	}

	if( Damaged ){

		apply_surface( 0, 0, DamageSheet, screen );

		DamageCounter += 1;

		if( DamageCounter == 4 )
			Damaged = false;

	}

}

void enemy :: fill_enemy(){

	for( int i = 0; i < EnemyNumber; i++ ){
		for( int j = 0; j < 10; j++ ){
			EnemyData[ i ][ j ].Coord.w = 86;
			EnemyData[ i ][ j ].Coord.h = 61;
			EnemyData[ i ][ j ].type = NoEnemy;
		}

	}

	//FILL THE ENEMIES
	EnemyData[ 0 ][ 0 ].type = EasyEnemy;

	EnemyData[ 1 ][ 0 ].type = EasyEnemy;
	EnemyData[ 1 ][ 1 ].type = EasyEnemy;
	EnemyData[ 1 ][ 2 ].type = EasyEnemy;
	EnemyData[ 1 ][ 3 ].type = Easy2Enemy;
	EnemyData[ 1 ][ 4 ].type = Easy2Enemy;
	EnemyData[ 1 ][ 5 ].type = Easy2Enemy;

	EnemyData[ 2 ][ 0 ].type = EasyEnemy;
	EnemyData[ 2 ][ 1 ].type = EasyEnemy;
	EnemyData[ 2 ][ 2 ].type = Easy2Enemy;
	EnemyData[ 2 ][ 3 ].type = Easy2Enemy;
	EnemyData[ 2 ][ 4 ].type = Normal2Enemy;
	EnemyData[ 2 ][ 5 ].type = Normal2Enemy;

	EnemyData[ 3 ][ 0 ].type = Easy2Enemy;
	EnemyData[ 3 ][ 1 ].type = Easy2Enemy;
	EnemyData[ 3 ][ 2 ].type = Easy2Enemy;
	EnemyData[ 3 ][ 3 ].type = Easy2Enemy;
	EnemyData[ 3 ][ 4 ].type = Easy2Enemy;

	EnemyData[ 4 ][ 0 ].type = Normal2Enemy;
	EnemyData[ 4 ][ 1 ].type = Normal2Enemy;
	EnemyData[ 4 ][ 2 ].type = Normal2Enemy;
	EnemyData[ 4 ][ 3 ].type = Normal2Enemy;

	EnemyData[ 5 ][ 0 ].type = Normal2Enemy;
	EnemyData[ 5 ][ 1 ].type = Normal2Enemy;
	EnemyData[ 5 ][ 2 ].type = EasyEnemy;
	EnemyData[ 5 ][ 3 ].type = EasyEnemy;
	EnemyData[ 5 ][ 4 ].type = Easy2Enemy;
	EnemyData[ 5 ][ 5 ].type = Easy2Enemy;
	EnemyData[ 5 ][ 6 ].type = NormalEnemy;
	EnemyData[ 5 ][ 7 ].type = NormalEnemy;

	EnemyData[ 6 ][ 0 ].type = Easy2Enemy;
	EnemyData[ 6 ][ 1 ].type = Easy2Enemy;
	EnemyData[ 6 ][ 2 ].type = Easy2Enemy;
	EnemyData[ 6 ][ 3 ].type = Easy2Enemy;
	EnemyData[ 6 ][ 4 ].type = EasyEnemy;
	EnemyData[ 6 ][ 5 ].type = EasyEnemy;
	EnemyData[ 6 ][ 6 ].type = NormalEnemy;
	EnemyData[ 6 ][ 7 ].type = NormalEnemy;
	EnemyData[ 6 ][ 8 ].type = Normal2Enemy;

	EnemyData[ 7 ][ 0 ].type = EasyEnemy;
	EnemyData[ 7 ][ 1 ].type = EasyEnemy;
	EnemyData[ 7 ][ 2 ].type = EasyEnemy;
	EnemyData[ 7 ][ 3 ].type = EasyEnemy;
	EnemyData[ 7 ][ 4 ].type = Easy2Enemy;
	EnemyData[ 7 ][ 5 ].type = Easy2Enemy;
	EnemyData[ 7 ][ 6 ].type = NormalEnemy;
	EnemyData[ 7 ][ 7 ].type = NormalEnemy;
	EnemyData[ 7 ][ 8 ].type = NormalEnemy;


	EnemyData[ 8 ][ 0 ].type = EasyEnemy;
	EnemyData[ 8 ][ 1 ].type = EasyEnemy;
	EnemyData[ 8 ][ 2 ].type = EasyEnemy;
	EnemyData[ 8 ][ 3 ].type = EasyEnemy;
	EnemyData[ 8 ][ 4 ].type = EasyEnemy;
	EnemyData[ 8 ][ 5 ].type = Easy2Enemy;
	EnemyData[ 8 ][ 6 ].type = Easy2Enemy;
	EnemyData[ 8 ][ 7 ].type = Easy2Enemy;
	EnemyData[ 8 ][ 8 ].type = Easy2Enemy;
	EnemyData[ 8 ][ 9 ].type = Easy2Enemy;

	EnemyData[ 9 ][ 0 ].type = NormalEnemy;
	EnemyData[ 9 ][ 1 ].type = NormalEnemy;
	EnemyData[ 9 ][ 2 ].type = NormalEnemy;
	EnemyData[ 9 ][ 3 ].type = NormalEnemy;
	EnemyData[ 9 ][ 4 ].type = Normal2Enemy;
	EnemyData[ 9 ][ 5 ].type = Normal2Enemy;
	EnemyData[ 9 ][ 6 ].type = Normal2Enemy;
	EnemyData[ 9 ][ 7 ].type = Normal2Enemy;
	EnemyData[ 9 ][ 8 ].type = HardEnemy;
	EnemyData[ 9 ][ 9 ].type = Hard2Enemy;

	EnemyData[ 10 ][ 0 ].type = HardEnemy;
	EnemyData[ 10 ][ 1 ].type = HardEnemy;
	EnemyData[ 10 ][ 2 ].type = HardEnemy;
	EnemyData[ 10 ][ 3 ].type = Hard2Enemy;
	EnemyData[ 10 ][ 4 ].type = Hard2Enemy;
	EnemyData[ 10 ][ 5 ].type = Hard2Enemy;
	EnemyData[ 10 ][ 6 ].type = NormalEnemy;
	EnemyData[ 10 ][ 7 ].type = NormalEnemy;
	EnemyData[ 10 ][ 8 ].type = Normal2Enemy;
	EnemyData[ 10 ][ 9 ].type = Normal2Enemy;

	EnemyData[ 11 ][ 0 ].type = NormalEnemy;
	EnemyData[ 11 ][ 1 ].type = NormalEnemy;
	EnemyData[ 11 ][ 2 ].type = NormalEnemy;
	EnemyData[ 11 ][ 3 ].type = NormalEnemy;
	EnemyData[ 11 ][ 4 ].type = NormalEnemy;
	EnemyData[ 11 ][ 5 ].type = NormalEnemy;
	EnemyData[ 11 ][ 6 ].type = Normal2Enemy;
	EnemyData[ 11 ][ 7 ].type = Normal2Enemy;
	EnemyData[ 11 ][ 8 ].type = Normal2Enemy;
	EnemyData[ 11 ][ 9 ].type = Normal2Enemy;

	EnemyData[ 12 ][ 0 ].type = NormalEnemy;
	EnemyData[ 12 ][ 1 ].type = NormalEnemy;
	EnemyData[ 12 ][ 2 ].type = NormalEnemy;
	EnemyData[ 12 ][ 3 ].type = NormalEnemy;
	EnemyData[ 12 ][ 4 ].type = Normal2Enemy;

	EnemyData[ 13 ][ 0 ].type = HardEnemy;
	EnemyData[ 13 ][ 1 ].type = HardEnemy;
	EnemyData[ 13 ][ 2 ].type = EasyEnemy;
	EnemyData[ 13 ][ 3 ].type = EasyEnemy;
	EnemyData[ 13 ][ 4 ].type = EasyEnemy;
	EnemyData[ 13 ][ 5 ].type = EasyEnemy;
	EnemyData[ 13 ][ 6 ].type = EasyEnemy;
	EnemyData[ 13 ][ 7 ].type = EasyEnemy;
	EnemyData[ 13 ][ 8 ].type = EasyEnemy;
	EnemyData[ 13 ][ 9 ].type = EasyEnemy;


	EnemyData[ 14 ][ 0 ].type = EasyEnemy;
	EnemyData[ 14 ][ 1 ].type = EasyEnemy;
	EnemyData[ 14 ][ 2 ].type = EasyEnemy;
	EnemyData[ 14 ][ 3 ].type = EasyEnemy;
	EnemyData[ 14 ][ 4 ].type = EasyEnemy;
	EnemyData[ 14 ][ 5 ].type = EasyEnemy;
	EnemyData[ 14 ][ 6 ].type = EasyEnemy;
	EnemyData[ 14 ][ 7 ].type = EasyEnemy;

	EnemyData[ 15 ][ 0 ].type = EasyEnemy;
	EnemyData[ 15 ][ 1 ].type = NormalEnemy;
	EnemyData[ 15 ][ 2 ].type = NormalEnemy;
	EnemyData[ 15 ][ 3 ].type = Normal2Enemy;
	EnemyData[ 15 ][ 4 ].type = Normal2Enemy;
	EnemyData[ 15 ][ 5 ].type = Normal2Enemy;

	EnemyData[ 16 ][ 0 ].type = NormalEnemy;
	EnemyData[ 16 ][ 1 ].type = NormalEnemy;
	EnemyData[ 16 ][ 2 ].type = NormalEnemy;
	EnemyData[ 16 ][ 3 ].type = NormalEnemy;
	EnemyData[ 16 ][ 4 ].type = Normal2Enemy;
	EnemyData[ 16 ][ 5 ].type = Normal2Enemy;
	EnemyData[ 16 ][ 6 ].type = Normal2Enemy;
	EnemyData[ 16 ][ 7 ].type = Normal2Enemy;

	EnemyData[ 17 ][ 0 ].type = Hard2Enemy;
	EnemyData[ 17 ][ 1 ].type = Hard2Enemy;
	EnemyData[ 17 ][ 2 ].type = HardEnemy;
	EnemyData[ 17 ][ 3 ].type = HardEnemy;
	EnemyData[ 17 ][ 4 ].type = EasyEnemy;
	EnemyData[ 17 ][ 5 ].type = EasyEnemy;
	EnemyData[ 17 ][ 6 ].type = EasyEnemy;
	EnemyData[ 17 ][ 7 ].type = Normal2Enemy;

	EnemyData[ 18 ][ 0 ].type = EasyEnemy;
	EnemyData[ 18 ][ 1 ].type = EasyEnemy;
	EnemyData[ 18 ][ 2 ].type = Easy2Enemy;
	EnemyData[ 18 ][ 3 ].type = Easy2Enemy;
	EnemyData[ 18 ][ 4 ].type = Easy2Enemy;
	EnemyData[ 18 ][ 5 ].type = Easy2Enemy;
	EnemyData[ 18 ][ 6 ].type = NormalEnemy;

	EnemyData[ 19 ][ 0 ].type = NormalEnemy;
	EnemyData[ 19 ][ 1 ].type = NormalEnemy;
	EnemyData[ 19 ][ 2 ].type = Normal2Enemy;
	EnemyData[ 19 ][ 3 ].type = Normal2Enemy;

	EnemyData[ 20 ][ 0 ].type = Hard2Enemy;
	EnemyData[ 20 ][ 1 ].type = Hard2Enemy;
	EnemyData[ 20 ][ 2 ].type = Hard2Enemy;
	EnemyData[ 20 ][ 3 ].type = Hard2Enemy;
	EnemyData[ 20 ][ 4 ].type = Hard2Enemy;
	EnemyData[ 20 ][ 5 ].type = Hard2Enemy;
	EnemyData[ 20 ][ 6 ].type = Hard2Enemy;
	EnemyData[ 20 ][ 7 ].type = Hard2Enemy;
	EnemyData[ 20 ][ 8 ].type = Hard2Enemy;
	EnemyData[ 20 ][ 9 ].type = Hard2Enemy;

	EnemyData[ 21 ][ 0 ].type = Normal2Enemy;
	EnemyData[ 21 ][ 1 ].type = Normal2Enemy;
	EnemyData[ 21 ][ 2 ].type = Normal2Enemy;
	EnemyData[ 21 ][ 3 ].type = Normal2Enemy;
	EnemyData[ 21 ][ 4 ].type = HardEnemy;

	EnemyData[ 22 ][ 0 ].type = EasyEnemy;
	EnemyData[ 22 ][ 1 ].type = EasyEnemy;
	EnemyData[ 22 ][ 2 ].type = Easy2Enemy;

	EnemyData[ 23 ][ 0 ].type = HardEnemy;
	EnemyData[ 23 ][ 1 ].type = HardEnemy;
	EnemyData[ 23 ][ 2 ].type = Hard2Enemy;
	EnemyData[ 23 ][ 3 ].type = Hard2Enemy;
	EnemyData[ 23 ][ 4 ].type = Hard2Enemy;




	//SECONDARY COORD FOR ALL
	for( int i = 0; i < EnemyNumber; i++ ){
		for( int j = 0; j < 10; j++ ){

			switch( j ){

				case 0 : EnemyData[ i ][ j ].Coord.x = 100;
					     EnemyData[ i ][ j ].Coord.y = 200;
					     break;

				case 1 : EnemyData[ i ][ j ].Coord.x = 150;
					     EnemyData[ i ][ j ].Coord.y = 150;
					     break;

				case 2 : EnemyData[ i ][ j ].Coord.x = 200;
					     EnemyData[ i ][ j ].Coord.y = 100;
					     break;

				case 3 : EnemyData[ i ][ j ].Coord.x = 450;
					     EnemyData[ i ][ j ].Coord.y = 150;
					     break;

				case 4 : EnemyData[ i ][ j ].Coord.x = 500;
					     EnemyData[ i ][ j ].Coord.y = 300;
					     break;

				case 5 : EnemyData[ i ][ j ].Coord.x = 450;
					     EnemyData[ i ][ j ].Coord.y = 450;
					     break;

				case 6 : EnemyData[ i ][ j ].Coord.x = 400;
					     EnemyData[ i ][ j ].Coord.y = 500;
					     break;

				case 7 : EnemyData[ i ][ j ].Coord.x = 150;
					     EnemyData[ i ][ j ].Coord.y = 450;
					     break;

				case 8 : EnemyData[ i ][ j ].Coord.x = 50;
					     EnemyData[ i ][ j ].Coord.y = 300;
					     break;

				case 9 : EnemyData[ i ][ j ].Coord.x = 550;
					     EnemyData[ i ][ j ].Coord.y = 300;
					     break;

			}

			EnemyData[ i ][ j ].dead = false;

			switch( EnemyData[ i ][ j ].type ){

				case EasyEnemy    : EnemyData[ i ][ j ].HP = 125; break;
				case Easy2Enemy   : EnemyData[ i ][ j ].HP = 125; break;
				case NormalEnemy  : EnemyData[ i ][ j ].HP = 150; break;
				case Normal2Enemy : EnemyData[ i ][ j ].HP = 150; break;
				case HardEnemy    : EnemyData[ i ][ j ].HP = 175; break;
				case Hard2Enemy   : EnemyData[ i ][ j ].HP = 175; break;


			}



			EnemyData[ i ][ j ].Coord.x += 50;

			if( i == 0 && j == 0){
				EnemyData[ i ][ j ].Coord.x = 470;
				EnemyData[ i ][ j ].Coord.y = 300;
			}

			EnemyData[ i ][ j ].Coord2.x = EnemyData[ i ][ j ].Coord.x;
			EnemyData[ i ][ j ].Coord2.y = EnemyData[ i ][ j ].Coord.y;

			EnemyData[ i ][ j ].birthcounter = 0;

		}
	}

}

bool enemy :: isTriggered(){
	return Triggered;
}
