publish my project

Dependencies:   mbed

Start/Start.cpp

Committer:
dongyuhu
Date:
2020-04-27
Revision:
4:fd47d9c11263
Parent:
3:c89450845b2a
Child:
5:c31ba165e49c

File content as of revision 4:fd47d9c11263:

#include "Start.h"
bool ifnotstop = true;

Start::Start()
{

}

Start::~Start()
{

}

void Start::init(int me_width,int me_height,int attacker_size,int speed)
{
    // initialise the game parameters
    _me_width = me_width;            //3
    _me_height = me_height;          //3  
    _attacker_size = attacker_size;  //2
    _speed = speed;                  //1



    _me.init(_mex,_mey,_me_height,_me_width);

    _attacker1.init1(_attacker_size,_speed);
    _attacker2.init2(_attacker_size,_speed);
    _attacker3.init3(_attacker_size,_speed);
    _attacker4.init4(_attacker_size,_speed);
    _attacker5.init5(_attacker_size,_speed);
    _attacker6.init6(_attacker_size,_speed);
    _attacker7.init7(_attacker_size,_speed);
    _attacker8.init8(_attacker_size,_speed);
    
}

void Start::read_input(Gamepad &pad)
{
    _d = pad.get_direction();
    _mag = pad.get_mag();
}

void Start::draw(N5110 &lcd)
{

    lcd.drawRect(0,0,WIDTH,HEIGHT,FILL_TRANSPARENT);    //draw the turrets
    lcd.drawRect(10,10,64,28,FILL_TRANSPARENT);    //map
    lcd.drawCircle(5,17,4,FILL_TRANSPARENT);
    lcd.drawCircle(5,31,4,FILL_TRANSPARENT);      //the two in left
    lcd.drawCircle(78,17,4,FILL_TRANSPARENT);
    lcd.drawCircle(78,31,4,FILL_TRANSPARENT);     //right
    lcd.drawCircle(30,5,4,FILL_TRANSPARENT);
    lcd.drawCircle(54,5,4,FILL_TRANSPARENT);      //up
    lcd.drawCircle(30,42,4,FILL_TRANSPARENT);
    lcd.drawCircle(54,42,4,FILL_TRANSPARENT);     //down

    _me.draw(lcd);
    _attacker1.draw(lcd);
    _attacker2.draw(lcd);
    _attacker3.draw(lcd);
    _attacker4.draw(lcd);
    _attacker5.draw(lcd);
    _attacker6.draw(lcd);
    _attacker7.draw(lcd);
    _attacker8.draw(lcd);
    
}

void Start::update(Gamepad &pad)
{
    _me.update(_d);
    _attacker1.update();
    _attacker2.update();
    _attacker3.update();
    _attacker4.update();
    _attacker5.update();
    _attacker6.update();
    _attacker7.update();
    _attacker8.update();

    check_wall_collision(pad);         
    check_body_collisions(pad);

}
void setpos(Vector2D attacker_pos,int x,int y)
{
     attacker_pos.x=x;        
     attacker_pos.y=y;
}

void JUDGE(Vector2D attacker11_pos,Vector2D attacker22_pos,Vector2D attacker33_pos,Vector2D attacker44_pos,Vector2D attacker55_pos,Vector2D attacker66_pos,Vector2D attacker77_pos,Vector2D attacker88_pos)
{
    if(attacker11_pos.y < 10||attacker11_pos.y > 36||attacker11_pos.x < 10||attacker11_pos.x > 72) 
        setpos(attacker11_pos,30,11);  
    else if(attacker22_pos.y < 10||attacker22_pos.y > 36||attacker22_pos.x < 10||attacker22_pos.x > 72)
        setpos(attacker22_pos,54,10); 
    else if(attacker33_pos.y < 10||attacker33_pos.y > 36||attacker33_pos.x < 10||attacker33_pos.x > 72)
        setpos(attacker33_pos,10,17); 
    else if(attacker44_pos.y < 10||attacker44_pos.y > 36||attacker11_pos.x < 10||attacker44_pos.x > 72)
        setpos(attacker44_pos,10,31);  
    else if(attacker55_pos.y < 10||attacker55_pos.y > 36||attacker55_pos.x < 10||attacker55_pos.x > 72)
        setpos(attacker55_pos,30,36); 
    else if(attacker66_pos.y < 10||attacker66_pos.y > 36||attacker66_pos.x < 10||attacker66_pos.x >72)
        setpos(attacker66_pos,54,36);
    else if(attacker77_pos.y < 10||attacker77_pos.y > 36||attacker77_pos.x < 10||attacker77_pos.x >72)
        setpos(attacker77_pos,71,31);
    else if(attacker88_pos.y < 10||attacker88_pos.y > 36||attacker88_pos.x < 10||attacker88_pos.x >72)
        setpos(attacker77_pos,71,17);
}

void Start::check_wall_collision(Gamepad &pad)
{
    Vector2D attacker11_pos = _attacker1.get_pos();
    Vector2D attacker22_pos = _attacker2.get_pos();
    Vector2D attacker33_pos = _attacker3.get_pos();
    Vector2D attacker44_pos = _attacker4.get_pos();
    Vector2D attacker55_pos = _attacker5.get_pos();
    Vector2D attacker66_pos = _attacker6.get_pos();
    Vector2D attacker77_pos = _attacker7.get_pos();
    Vector2D attacker88_pos = _attacker8.get_pos();

    JUDGE(attacker11_pos,attacker22_pos,attacker33_pos,attacker44_pos,attacker55_pos,attacker66_pos,attacker77_pos,attacker88_pos);
       
    _attacker1.set_pos(attacker11_pos);
    _attacker2.set_pos(attacker22_pos);
    _attacker3.set_pos(attacker33_pos);
    _attacker4.set_pos(attacker44_pos);
    _attacker5.set_pos(attacker55_pos);
    _attacker6.set_pos(attacker66_pos);
    _attacker7.set_pos(attacker77_pos);
    _attacker8.set_pos(attacker88_pos);

}


  void Start::check_body_collisions(Gamepad &pad)
{
        Vector2D attacker11_pos = _attacker1.get_pos();
        Vector2D attacker22_pos = _attacker2.get_pos();
        Vector2D attacker33_pos = _attacker3.get_pos();
        Vector2D attacker44_pos = _attacker4.get_pos();
        Vector2D attacker55_pos = _attacker5.get_pos();
        Vector2D attacker66_pos = _attacker6.get_pos();
        Vector2D attacker77_pos = _attacker7.get_pos();
        Vector2D attacker88_pos = _attacker8.get_pos();
        

        Vector2D me_pos = _me.get_pos();
    if ((attacker11_pos.x+1 == me_pos.x) &&(attacker11_pos.y+1 == me_pos.y)||
        (attacker11_pos.x+1 == me_pos.x) &&(attacker11_pos.y   == me_pos.y)||
        (attacker11_pos.x+1 == me_pos.x) &&(attacker11_pos.y-1 == me_pos.y)||  
        (attacker11_pos.x+1 == me_pos.x) &&(attacker11_pos.y-2 == me_pos.y)        //if attacker collides me from left
       )
      {
        ifnotstop = false;
       attacker11_pos.x=30;                                                        //attacker back to initial position
       attacker11_pos.y=11;                
      }
    if ((attacker11_pos.x == me_pos.x+2) &&(attacker11_pos.y+1 == me_pos.y)||
        (attacker11_pos.x == me_pos.x+2) &&(attacker11_pos.y   == me_pos.y)||
        (attacker11_pos.x == me_pos.x+2) &&(attacker11_pos.y-1 == me_pos.y)||  
        (attacker11_pos.x == me_pos.x+2) &&(attacker11_pos.y-2 == me_pos.y)        //right
       )
      {
        ifnotstop = false;
       attacker11_pos.x=30;
       attacker11_pos.y=11;
      }
    if ((attacker11_pos.x == me_pos.x-1) &&(attacker11_pos.y+2 == me_pos.y+1)||
        (attacker11_pos.x == me_pos.x  ) &&(attacker11_pos.y+2 == me_pos.y+1)||
        (attacker11_pos.x == me_pos.x+1) &&(attacker11_pos.y+2 == me_pos.y+1)||  
        (attacker11_pos.x == me_pos.x+2) &&(attacker11_pos.y+2 == me_pos.y+1)        //up
       )
      {
        ifnotstop = false;
       attacker11_pos.x=30;
       attacker11_pos.y=11;
      }
    if ((attacker11_pos.x == me_pos.x-1) &&(attacker11_pos.y == me_pos.y+2)||
        (attacker11_pos.x == me_pos.x  ) &&(attacker11_pos.y == me_pos.y+2)||
        (attacker11_pos.x == me_pos.x+1) &&(attacker11_pos.y == me_pos.y+2)||  
        (attacker11_pos.x == me_pos.x+2) &&(attacker11_pos.y == me_pos.y+2)        //down
       )
      {
        ifnotstop = false;
       attacker11_pos.x=30;
       attacker11_pos.y=11;
      }
 /////////////////////////////////////////////////////////////////////////////////////////////////     
      
    if ((attacker22_pos.x+1 == me_pos.x) &&(attacker22_pos.y+1 == me_pos.y)||
        (attacker22_pos.x+1 == me_pos.x) &&(attacker22_pos.y   == me_pos.y)||
        (attacker22_pos.x+1 == me_pos.x) &&(attacker22_pos.y-1 == me_pos.y)||  
        (attacker22_pos.x+1 == me_pos.x) &&(attacker22_pos.y-2 == me_pos.y)        //left
       )
      {
        ifnotstop = false;
       attacker22_pos.x=54;
       attacker22_pos.y=10;
      }
    if ((attacker22_pos.x == me_pos.x+2) &&(attacker22_pos.y+1 == me_pos.y)||
        (attacker22_pos.x == me_pos.x+2) &&(attacker22_pos.y   == me_pos.y)||
        (attacker22_pos.x == me_pos.x+2) &&(attacker22_pos.y-1 == me_pos.y)||  
        (attacker22_pos.x == me_pos.x+2) &&(attacker22_pos.y-2 == me_pos.y)        //right
       )
      {
        ifnotstop = false;
       attacker22_pos.x=54;
       attacker22_pos.y=10;
      }
    if ((attacker22_pos.x == me_pos.x-1) &&(attacker22_pos.y+2 == me_pos.y+1)||
        (attacker22_pos.x == me_pos.x  ) &&(attacker22_pos.y+2 == me_pos.y+1)||
        (attacker22_pos.x == me_pos.x+1) &&(attacker22_pos.y+2 == me_pos.y+1)||  
        (attacker22_pos.x == me_pos.x+2) &&(attacker22_pos.y+2 == me_pos.y+1)        //up
       )
      {
        ifnotstop = false;
       attacker22_pos.x=54;
       attacker22_pos.y=10;
      }
    if ((attacker22_pos.x == me_pos.x-1) &&(attacker22_pos.y == me_pos.y+2)||
        (attacker22_pos.x == me_pos.x  ) &&(attacker22_pos.y == me_pos.y+2)||
        (attacker22_pos.x == me_pos.x+1) &&(attacker22_pos.y == me_pos.y+2)||  
        (attacker22_pos.x == me_pos.x+2) &&(attacker22_pos.y == me_pos.y+2)        //down
       )
      {
        ifnotstop = false;
       attacker22_pos.x=54;
       attacker22_pos.y=10;
      }
      /////////////////////////////////////////////////////////////////
    if ((attacker33_pos.x+1 == me_pos.x) &&(attacker33_pos.y+1 == me_pos.y)||
        (attacker33_pos.x+1 == me_pos.x) &&(attacker33_pos.y   == me_pos.y)||
        (attacker33_pos.x+1 == me_pos.x) &&(attacker33_pos.y-1 == me_pos.y)||  
        (attacker33_pos.x+1 == me_pos.x) &&(attacker33_pos.y-2 == me_pos.y)        //left
       )
      {
        ifnotstop = false;
       attacker33_pos.x=10;
       attacker33_pos.y=17;
      }
    if ((attacker33_pos.x == me_pos.x+2) &&(attacker33_pos.y+1 == me_pos.y)||
        (attacker33_pos.x == me_pos.x+2) &&(attacker33_pos.y   == me_pos.y)||
        (attacker33_pos.x == me_pos.x+2) &&(attacker33_pos.y-1 == me_pos.y)||  
        (attacker33_pos.x == me_pos.x+2) &&(attacker33_pos.y-2 == me_pos.y)        //right
       )
      {
        ifnotstop = false;
       attacker33_pos.x=10;
       attacker33_pos.y=17;
      }
    if ((attacker33_pos.x == me_pos.x-1) &&(attacker33_pos.y+2 == me_pos.y+1)||
        (attacker33_pos.x == me_pos.x  ) &&(attacker33_pos.y+2 == me_pos.y+1)||
        (attacker33_pos.x == me_pos.x+1) &&(attacker33_pos.y+2 == me_pos.y+1)||  
        (attacker33_pos.x == me_pos.x+2) &&(attacker33_pos.y+2 == me_pos.y+1)        //up
       )
      {
        ifnotstop = false;
       attacker33_pos.x=10;
       attacker33_pos.y=17;
      }
    if ((attacker33_pos.x == me_pos.x-1) &&(attacker33_pos.y == me_pos.y+2)||
        (attacker33_pos.x == me_pos.x  ) &&(attacker33_pos.y == me_pos.y+2)||
        (attacker33_pos.x == me_pos.x+1) &&(attacker33_pos.y == me_pos.y+2)||  
        (attacker33_pos.x == me_pos.x+2) &&(attacker33_pos.y == me_pos.y+2)        //down
       )
      {
        ifnotstop = false;
       attacker33_pos.x=10;
       attacker33_pos.y=17;
      }
 /////////////////////////////////////////////////////////////////////////////////////////////////     
      
    if ((attacker44_pos.x+1 == me_pos.x) &&(attacker44_pos.y+1 == me_pos.y)||
        (attacker44_pos.x+1 == me_pos.x) &&(attacker44_pos.y   == me_pos.y)||
        (attacker44_pos.x+1 == me_pos.x) &&(attacker44_pos.y-1 == me_pos.y)||  
        (attacker44_pos.x+1 == me_pos.x) &&(attacker44_pos.y-2 == me_pos.y)        //left
       )
      {
        ifnotstop = false;
       attacker44_pos.x=10;
       attacker44_pos.y=31;
      }
    if ((attacker44_pos.x == me_pos.x+2) &&(attacker44_pos.y+1 == me_pos.y)||
        (attacker44_pos.x == me_pos.x+2) &&(attacker44_pos.y   == me_pos.y)||
        (attacker44_pos.x == me_pos.x+2) &&(attacker44_pos.y-1 == me_pos.y)||  
        (attacker44_pos.x == me_pos.x+2) &&(attacker44_pos.y-2 == me_pos.y)        //right
       )
      {
        ifnotstop = false;
       attacker44_pos.x=10;
       attacker44_pos.y=31;
      }
    if ((attacker44_pos.x == me_pos.x-1) &&(attacker44_pos.y+2 == me_pos.y+1)||
        (attacker44_pos.x == me_pos.x  ) &&(attacker44_pos.y+2 == me_pos.y+1)||
        (attacker44_pos.x == me_pos.x+1) &&(attacker44_pos.y+2 == me_pos.y+1)||  
        (attacker44_pos.x == me_pos.x+2) &&(attacker44_pos.y+2 == me_pos.y+1)        //up
       )
      {
        ifnotstop = false;
       attacker44_pos.x=10;
       attacker44_pos.y=31;
      }
    if ((attacker44_pos.x == me_pos.x-1) &&(attacker44_pos.y == me_pos.y+2)||
        (attacker44_pos.x == me_pos.x  ) &&(attacker44_pos.y == me_pos.y+2)||
        (attacker44_pos.x == me_pos.x+1) &&(attacker44_pos.y == me_pos.y+2)||  
        (attacker44_pos.x == me_pos.x+2) &&(attacker44_pos.y == me_pos.y+2)        //down
       )
      {
        ifnotstop = false;
       attacker44_pos.x=10;
       attacker44_pos.y=31;
      }
      ///////////////////////////////////////////////////////////////////
    if ((attacker55_pos.x+1 == me_pos.x) &&(attacker55_pos.y+1 == me_pos.y)||
        (attacker55_pos.x+1 == me_pos.x) &&(attacker55_pos.y   == me_pos.y)||
        (attacker55_pos.x+1 == me_pos.x) &&(attacker55_pos.y-1 == me_pos.y)||  
        (attacker55_pos.x+1 == me_pos.x) &&(attacker55_pos.y-2 == me_pos.y)        //left
       )
      {
        ifnotstop = false;
       attacker55_pos.x=30;
       attacker55_pos.y=38;
      }
    if ((attacker55_pos.x == me_pos.x+2) &&(attacker55_pos.y+1 == me_pos.y)||
        (attacker55_pos.x == me_pos.x+2) &&(attacker55_pos.y   == me_pos.y)||
        (attacker55_pos.x == me_pos.x+2) &&(attacker55_pos.y-1 == me_pos.y)||  
        (attacker55_pos.x == me_pos.x+2) &&(attacker55_pos.y-2 == me_pos.y)        //right
       )
      {
        ifnotstop = false;
       attacker11_pos.x=30;
       attacker11_pos.y=38;
      }
    if ((attacker55_pos.x == me_pos.x-1) &&(attacker55_pos.y+2 == me_pos.y+1)||
        (attacker55_pos.x == me_pos.x  ) &&(attacker55_pos.y+2 == me_pos.y+1)||
        (attacker55_pos.x == me_pos.x+1) &&(attacker55_pos.y+2 == me_pos.y+1)||  
        (attacker55_pos.x == me_pos.x+2) &&(attacker55_pos.y+2 == me_pos.y+1)        //up
       )
      {
        ifnotstop = false;
       attacker55_pos.x=30;
       attacker55_pos.y=38;
      }
    if ((attacker55_pos.x == me_pos.x-1) &&(attacker55_pos.y == me_pos.y+2)||
        (attacker55_pos.x == me_pos.x  ) &&(attacker55_pos.y == me_pos.y+2)||
        (attacker55_pos.x == me_pos.x+1) &&(attacker55_pos.y == me_pos.y+2)||  
        (attacker55_pos.x == me_pos.x+2) &&(attacker55_pos.y == me_pos.y+2)        //down
       )
      {
        ifnotstop = false;
       attacker55_pos.x=30;
       attacker55_pos.y=38;
      }
 /////////////////////////////////////////////////////////////////////////////////////////////////     
      
    if ((attacker66_pos.x+1 == me_pos.x) &&(attacker66_pos.y+1 == me_pos.y)||
        (attacker66_pos.x+1 == me_pos.x) &&(attacker66_pos.y   == me_pos.y)||
        (attacker66_pos.x+1 == me_pos.x) &&(attacker66_pos.y-1 == me_pos.y)||  
        (attacker66_pos.x+1 == me_pos.x) &&(attacker66_pos.y-2 == me_pos.y)        //left
       )
      {
        ifnotstop = false;
       attacker66_pos.x=54;
       attacker66_pos.y=38;
      }
    if ((attacker66_pos.x == me_pos.x+2) &&(attacker66_pos.y+1 == me_pos.y)||
        (attacker66_pos.x == me_pos.x+2) &&(attacker66_pos.y   == me_pos.y)||
        (attacker66_pos.x == me_pos.x+2) &&(attacker66_pos.y-1 == me_pos.y)||  
        (attacker66_pos.x == me_pos.x+2) &&(attacker66_pos.y-2 == me_pos.y)        //right
       )
      {
        ifnotstop = false;
       attacker66_pos.x=54;
       attacker66_pos.y=38;
      }
    if ((attacker66_pos.x == me_pos.x-1) &&(attacker66_pos.y+2 == me_pos.y+1)||
        (attacker66_pos.x == me_pos.x  ) &&(attacker66_pos.y+2 == me_pos.y+1)||
        (attacker66_pos.x == me_pos.x+1) &&(attacker66_pos.y+2 == me_pos.y+1)||  
        (attacker66_pos.x == me_pos.x+2) &&(attacker66_pos.y+2 == me_pos.y+1)        //up
       )
      {
        ifnotstop = false;
       attacker66_pos.x=54;
       attacker66_pos.y=38;
      }
    if ((attacker66_pos.x == me_pos.x-1) &&(attacker66_pos.y == me_pos.y+2)||
        (attacker66_pos.x == me_pos.x  ) &&(attacker66_pos.y == me_pos.y+2)||
        (attacker66_pos.x == me_pos.x+1) &&(attacker66_pos.y == me_pos.y+2)||  
        (attacker66_pos.x == me_pos.x+2) &&(attacker66_pos.y == me_pos.y+2)        //down
       )
      {
        ifnotstop = false;
       attacker66_pos.x=54;
       attacker66_pos.y=38;
      }
      ///////////////////////////////////////////////////////
    if ((attacker77_pos.x+1 == me_pos.x) &&(attacker77_pos.y+1 == me_pos.y)||
        (attacker77_pos.x+1 == me_pos.x) &&(attacker77_pos.y   == me_pos.y)||
        (attacker77_pos.x+1 == me_pos.x) &&(attacker77_pos.y-1 == me_pos.y)||  
        (attacker77_pos.x+1 == me_pos.x) &&(attacker77_pos.y-2 == me_pos.y)        //left
       )
      {
        ifnotstop = false;
       attacker77_pos.x=74;
       attacker77_pos.y=31;
      }
    if ((attacker77_pos.x == me_pos.x+2) &&(attacker77_pos.y+1 == me_pos.y)||
        (attacker77_pos.x == me_pos.x+2) &&(attacker77_pos.y   == me_pos.y)||
        (attacker77_pos.x == me_pos.x+2) &&(attacker77_pos.y-1 == me_pos.y)||  
        (attacker77_pos.x == me_pos.x+2) &&(attacker77_pos.y-2 == me_pos.y)        //right
       )
      {
        ifnotstop = false;
       attacker77_pos.x=74;
       attacker77_pos.y=31;
      }
    if ((attacker77_pos.x == me_pos.x-1) &&(attacker77_pos.y+2 == me_pos.y+1)||
        (attacker77_pos.x == me_pos.x  ) &&(attacker77_pos.y+2 == me_pos.y+1)||
        (attacker77_pos.x == me_pos.x+1) &&(attacker77_pos.y+2 == me_pos.y+1)||  
        (attacker77_pos.x == me_pos.x+2) &&(attacker77_pos.y+2 == me_pos.y+1)        //up
       )
      {
        ifnotstop = false;
       attacker77_pos.x=74;
       attacker77_pos.y=31;
      }
    if ((attacker77_pos.x == me_pos.x-1) &&(attacker77_pos.y == me_pos.y+2)||
        (attacker77_pos.x == me_pos.x  ) &&(attacker77_pos.y == me_pos.y+2)||
        (attacker77_pos.x == me_pos.x+1) &&(attacker77_pos.y == me_pos.y+2)||  
        (attacker77_pos.x == me_pos.x+2) &&(attacker77_pos.y == me_pos.y+2)        //down
       )
      {
       ifnotstop = false;
       attacker77_pos.x=74;
       attacker77_pos.y=31;
      }
 /////////////////////////////////////////////////////////////////////////////////////////////////     
      
    if ((attacker88_pos.x+1 == me_pos.x) &&(attacker88_pos.y+1 == me_pos.y)||
        (attacker88_pos.x+1 == me_pos.x) &&(attacker88_pos.y   == me_pos.y)||
        (attacker88_pos.x+1 == me_pos.x) &&(attacker88_pos.y-1 == me_pos.y)||  
        (attacker88_pos.x+1 == me_pos.x) &&(attacker88_pos.y-2 == me_pos.y)        //left
       )
      {
        ifnotstop = false;
       attacker88_pos.x=74;
       attacker88_pos.y=17;
      }
    if ((attacker88_pos.x == me_pos.x+2) &&(attacker88_pos.y+1 == me_pos.y)||
        (attacker88_pos.x == me_pos.x+2) &&(attacker88_pos.y   == me_pos.y)||
        (attacker88_pos.x == me_pos.x+2) &&(attacker88_pos.y-1 == me_pos.y)||  
        (attacker88_pos.x == me_pos.x+2) &&(attacker88_pos.y-2 == me_pos.y)        //right
       )
      {
        ifnotstop = false;
       attacker88_pos.x=74;
       attacker88_pos.y=17;
      }
    if ((attacker88_pos.x == me_pos.x-1) &&(attacker88_pos.y+2 == me_pos.y+1)||
        (attacker88_pos.x == me_pos.x  ) &&(attacker88_pos.y+2 == me_pos.y+1)||
        (attacker88_pos.x == me_pos.x+1) &&(attacker88_pos.y+2 == me_pos.y+1)||  
        (attacker88_pos.x == me_pos.x+2) &&(attacker88_pos.y+2 == me_pos.y+1)        //up
       )
      {
        ifnotstop = false;
       attacker88_pos.x=74;
       attacker88_pos.y=17;
      }
    if ((attacker88_pos.x == me_pos.x-1) &&(attacker88_pos.y == me_pos.y+2)||
        (attacker88_pos.x == me_pos.x  ) &&(attacker88_pos.y == me_pos.y+2)||
        (attacker88_pos.x == me_pos.x+1) &&(attacker88_pos.y == me_pos.y+2)||  
        (attacker88_pos.x == me_pos.x+2) &&(attacker88_pos.y == me_pos.y+2)        //down
       )
      {
        ifnotstop = false;
       attacker88_pos.x=74;
       attacker88_pos.y=17;
      }
      
    _attacker1.set_pos(attacker11_pos);
    _attacker2.set_pos(attacker22_pos);
    _attacker3.set_pos(attacker33_pos);
    _attacker4.set_pos(attacker44_pos);
    _attacker5.set_pos(attacker55_pos);
    _attacker6.set_pos(attacker66_pos);
    _attacker7.set_pos(attacker77_pos);
    _attacker8.set_pos(attacker88_pos);
    
}