//Efekler 
//patlama lazer v.s.


#include "mostemp.h"

MOSSprite * s3;
MOSSpriteList EfekSprites;

void sprite_ekle_efek(MOSTile *tile,int type,int x,int y,int state,int frame,int delay)
{
	//	top.Olustur(resim,pencere.g_EkranY,"data/spr/top",false,"data/spr/topm",16,16);
			
	       
	        s3 = new MOSSprite();
		    s3->OlusturEfek(tile);
			s3->SetType(type);					// Sprite Type
			s3->SetPosX(x);					// Xpos of Sprite
			s3->SetPosY(y);					// Ypos of Sprite
			s3->SetVelX(0);							// XVel of Sprite
			s3->SetVelY(0);							// YVel of Sprite
			s3->SetState(state);						// IT's ALIVE!!!
			s3->SetFrame(frame);				// Frame to start with
			s3->SetDelay(delay);		// Set but, value is global for Vaders. 

			EfekSprites.EkleSprite(s3);
}
void update_sprite_efek()
{


	
	MOSSprite* Nodes1;


	for(Nodes1 = EfekSprites.GetFirst(); Nodes1 != NULL; Nodes1 = EfekSprites.GetNext(Nodes1))
	{
       // What state
        switch(Nodes1->GetType())
        {
          
            case TYPE_EFEK:    
            {
				if(Nodes1->GetState() == OYUNAG)
				{
					
					Nodes1->SetState(CANLI);
				
				}
                if (Nodes1->GetState() == CANLI)
                {  
				   
					if(Nodes1->m_Delay == 100)
					{
						Nodes1->SetState(BOS);
					}
				}
		
				if (Nodes1->GetState() == BOS)
                {
			       EfekSprites.KaldirSprite(Nodes1);
                    
                }
                
        
            } break;   
					

		}
			

		}
}

void Sprites_Update_Efek(DWORD drawturu,bool blend,float hiz)
{
	
	update_sprite_efek();

	EfekSprites.DrawEfek(drawturu,blend,hiz);

}
			