task Meteor(x,y,v,angle,color,size,center){
           let c= Obj_Create(OBJ_EFFECT);
             Obj_SetX(c,x);
             Obj_SetY(c,y);
             Obj_SetSpeed(c,v);
             Obj_SetAngle(c,angle);
             ObjEffect_SetAngle(c,0,0,angle+90);
             ObjEffect_SetTexture(c,star);
          ObjEffect_SetRenderState(c,ALPHA);
             ObjEffect_SetPrimitiveType(c,PRIMITIVE_TRIANGLEFAN);
             ObjEffect_SetLayer(c,3);
             ObjEffect_CreateVertex(c,62);
             ObjEffect_SetVertexXY(c,0,0,0);
        /*     ObjEffect_SetVertexUV(c,0,16+32*(color-161),354);  */
        /*     ObjEffect_SetVertexColor(c,0,255,255,255,255);  */
             ObjEffect_SetScale(c,size/10,size/10);
  if(center == 1 && centercolor(color) == 1){ObjEffect_SetVertexColor(c,0,255,255,0,0);}
  else if(center == 1 && centercolor(color) == 2){ObjEffect_SetVertexColor(c,0,255,255,128,0);}
  else if(center == 1 && centercolor(color) == 3){ObjEffect_SetVertexColor(c,0,255,255,255,0);}
  else if(center == 1 && centercolor(color) == 4){ObjEffect_SetVertexColor(c,0,255,0,255,0);}
  else if(center == 1 && centercolor(color) == 5){ObjEffect_SetVertexColor(c,0,255,128,128,255);}
  else if(center == 1 && centercolor(color) == 6){ObjEffect_SetVertexColor(c,0,255,0,0,255);}
  else if(center == 1 && centercolor(color) == 7){ObjEffect_SetVertexColor(c,0,255,255,0,255);}
  else if(center == 1 && centercolor(color) == 0){ObjEffect_SetVertexColor(c,0,255,128,128,128);}

  if(color>=1 && color<=8){
   ObjEffect_SetVertexUV(c,0,6+12*(color-1),6);
    wait(1);
       ascent(let i in 0..61){
                ObjEffect_SetVertexXY(c,i+1,cos(i*6)*20,sin(i*6)*20);
                ObjEffect_SetVertexUV(c,i+1,cos(i*6)*6+6+12*(color-1),sin(i*6)*6+6);
                ObjEffect_SetVertexColor(c,i+1,255,255,255,255);
            }
       }

   else if(color>=9 && color<=16){
   ObjEffect_SetVertexUV(c,0,17/2+18*(color-9),41/2);
    wait(1);
       ascent(let i in 0..61){
                ObjEffect_SetVertexXY(c,i+1,cos(i*6)*20,sin(i*6)*20);
                ObjEffect_SetVertexUV(c,i+1,cos(i*6)*17/2+17/2+18*(color-9),sin(i*6)*17/2+41/2);
                ObjEffect_SetVertexColor(c,i+1,255,255,255,255);
            }
       }

   else if(color>=25 && color<=32){
    ObjEffect_SetVertexUV(c,0,19/2+20*(color-25),79/2);
        ascent(let i in 0..61){
                ObjEffect_SetVertexXY(c,i+1,cos(i*6)*20,sin(i*6)*20);
                ObjEffect_SetVertexUV(c,i+1,cos(i*6)*19/2+19/2+20*(color-25),sin(i*6)*19/2+79/2);
                ObjEffect_SetVertexColor(c,i+1,255,255,255,255);
            }
       }

   else if(color>=33 && color<=40){
    ObjEffect_SetVertexUV(c,0,29/2+30*(color-33),129/2);
        ascent(let i in 0..61){
                ObjEffect_SetVertexXY(c,i+1,cos(i*6)*20,sin(i*6)*20);
                ObjEffect_SetVertexUV(c,i+1,cos(i*6)*29/2+29/2+30*(color-33),sin(i*6)*29/2+129/2);
                ObjEffect_SetVertexColor(c,i+1,255,255,255,255);
            }
       }

  else if(color>=73 && color<=80){
    ObjEffect_SetVertexUV(c,0,17/2+18*(color-73),172);
        ascent(let i in 0..61){
                ObjEffect_SetVertexXY(c,i+1,cos(i*6)*20,sin(i*6)*20);
                ObjEffect_SetVertexUV(c,i+1,cos(i*6)*17/2+17/2+18*(color-73),sin(i*6)*14+172);
                ObjEffect_SetVertexColor(c,i+1,255,255,255,255);
            }
       }

  else if(color>=81 && color<=88){
    ObjEffect_SetVertexUV(c,0,11/2+12*(color-81),128);
        ascent(let i in 0..61){
                ObjEffect_SetVertexXY(c,i+1,cos(i*6)*20,sin(i*6)*20);
                ObjEffect_SetVertexUV(c,i+1,cos(i*6)*11/2+11/2+12*(color-81),sin(i*6)*10+128);
                ObjEffect_SetVertexColor(c,i+1,255,255,255,255);
            }
       }

   else if(color>=88 && color<=96){
    ObjEffect_SetVertexUV(c,0,11/2+12*(color-88),148);
        ascent(let i in 0..61){
                ObjEffect_SetVertexXY(c,i+1,cos(i*6)*20,sin(i*6)*20);
                ObjEffect_SetVertexUV(c,i+1,cos(i*6)*11/2+11/2+12*(color-88),sin(i*6)*10+148);
                ObjEffect_SetVertexColor(c,i+1,255,255,255,255);
            }
       }

   else if(color>=161 && color<=168){
   ObjEffect_SetVertexUV(c,0,16+32*(color-161),354);
    wait(1);
       ascent(let i in 0..61){
                ObjEffect_SetVertexXY(c,i+1,cos(i*6)*20,sin(i*6)*20);
                ObjEffect_SetVertexUV(c,i+1,cos(i*6)*16+16+32*(color-161),sin(i*6)*16+354);
                ObjEffect_SetVertexColor(c,i+1,255,255,255,255);
            }
       }

      Spin;
       task Spin{
      let h = 0;
         while(!Obj_BeDeleted(c)){
          /*  Obj_SetX(c,GetX); Obj_SetY(c,GetY);*/
            ObjEffect_SetAngle(c,0,0,h);
            h += 4;
            wait2(1);
           }
         }
      Damage;
       task Damage{
           while(!Obj_BeDeleted(c)){
             /*    Obj_SetY(c,Obj_GetY(c)); */
            if((GetPlayerX-Obj_GetX(c))^2+(GetPlayerY-Obj_GetY(c))^2<(size+10)^2/2&&GetTimeOfPlayerInvincibility==0){
                 ShootDownPlayer();
                  }
            if((GetPlayerX-Obj_GetX(c))^2+(GetPlayerY-Obj_GetY(c))^2<(size+50)^2/2&&GetTimeOfPlayerInvincibility==0){
                 AddGraze(1); PlaySE("seGraze.wav");
                  }
                   wait2(1);
                }
            }
       Delete;
        task Delete{
          while(!Obj_BeDeleted(c)){
             if(OnBomb){
              CreateItem(ITEM_SCORE,Obj_GetX(c),Obj_GetY(c));
              Obj_Delete(c);
              }
           if(OnPlayerMissed){
           Obj_Delete(c);
             }
         if(Obj_GetX(c)>GetClipMaxX+64+2*size || Obj_GetX(c)<GetClipMinX-64-2*size || Obj_GetY(c)>GetClipMaxY+64+2*size || Obj_GetY(c)<GetClipMinY-64-2*size){
           Obj_Delete(c);
             }
         wait2(1);
           }
        }
      Light;
      task Light{
      while(!Obj_BeDeleted(c)){
       let r = rand(0,size*2);
      let p = rand(0,180);
       let x = Obj_GetX(c)+offsetX2(r,p);
       let y = Obj_GetY(c)+offsetY2(r,p);
       let v = 0; let angle = p;
       let delay = rand(30,30);
         CreateShotA(0,x,y,delay); 
         SetShotDataA(0,0,v,angle,0,0,0,color);
       SetShotKillTime(0,0);
         FireShot(0);
        wait(1);
        }
       }
    }

  function offsetX2(radius,angle){
           return radius * cos(angle);
     }

        function offsetY2(radius,angle){
            return radius * sin(angle);
     }

  function centercolor(color){
       return trunc(color-trunc(color/8)*8);
     }

  function wait2(w){
                loop(w){yield;}
       }