package com.tankalfa;
import android.graphics.Bitmap;
import com.osnova.Ran;
import com.osnova.Sprite;





public class Tn extends Os{
  
    public boolean live=true;
    public int tank=1;
    public int sks=10;
    public int bron=0;
    private int sot=0;
    private int ss;
    
   private int br;
   public int ib=0,de=0;
   
   Vz v;
  
     
    public Tn(Bitmap bi,int fx,int fy,int ae){
        
      super(bi,fx,fy,ae);
        
      abc(1);
      
  
     v=new Vz(); 
    }   
    
    
    public void key(){
   
      
      
      
      if(!live){x1=-200;y1=-200;de=1;} 
      
     if(live){de=0;
      ss++;   
   if(ss>=100){ sot=Ran.rnd(5); ss=0;}
        
     if(sot==1){st=1;next2Frame(0,1);y1-=sk1;}   
     if(sot==2){st=2;next2Frame(2,3);y1+=sk1;}
     if(sot==3){st=3;next2Frame(4,5);x1-=sk1;} 
     if(sot==4){st=4;next2Frame(6,7);x1+=sk1;}  
   } 
   
   
   
   
   }
     
    
     @Override
    public void StolkMap(Sprite c,int op){
       
  
    if(collides(c) & op==1){TiDe(c,7,10,7,10);}  
    if(collides(c) & op==2){TiDe(c,7,10,7,10);}  
    if(collides(c) & op==3){Pr(c);}
    if(collides(c) & op==4){TiDe(c,7,7,7,50);}
    if(collides(c) & op==5){TiDe(c,7,7,50,7);}
 }
    
    
    
    public void abc(int tank){
        
        this.tank=tank;
         live=true;
       // машина
      if(tank==-1){sk1=10;setImage(D.zil2,64,64);}
      if(tank==0){sk1=10; setImage(D.zil,64,64);}
      // выбор танка
       if(tank==1){sk1=6;sks=10;bron=0; setImage(D.a,64,64);} // лёгкий 
       if(tank==2){sk1=4;sks=15;bron=0; setImage(D.b,64,64);}// средний
       if(tank==3){sk1=2;sks=25;bron=0; setImage(D.c,64,64);}// тяжёлый 
        // с бронёй
      if(tank==4){sk1=6;sks=10;bron=20; setImage(D.ab,64,64);} 
      if(tank==5){sk1=4;sks=15;bron=50; setImage(D.bb,64,64);} 
      if(tank==6){sk1=2;sks=25;bron=80; setImage(D.cb,64,64);}
         
      
      
    }
    
   /// Минус процент Брони npc
   public void mBron(){
      
    if(bron<=0){live=false;v.an=1;ib=0;}  
    if(bron>=1){
      if(ib==D.ur){br++;} 
      if(br>2){bron-=ib;br=0;ib=0;}   
      }  
       
   }
   
   
   
   
   
   
   
   
   /*
   public void vox(){
      
     if(b==0) {vx=x1;vy=y1;b=1;}
      
      
   }
   
   public void box(){
     // an=1;
     if(an==1){vox();
     a++;vz.nextFrame(0);}
     if(a>16){an=0;a=0;b=0;}
  
   
   
   }
   ////////
   public void Vod(){
      
   vz.setPosition(vx-D.x,vy-D.y);
   vz.paint(Ran.c); 
      
}*/
   
   
    //// e c////
}
