Hu Dongyu
/
HuDongyu
publish my project
Diff: Start/Start.cpp
- Revision:
- 0:9e95a5ef2659
- Child:
- 3:c89450845b2a
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Start/Start.cpp Mon Apr 27 06:14:34 2020 +0000 @@ -0,0 +1,632 @@ +#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 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(); + + + if(attacker11_pos.y < 10) //if collision, + { + attacker11_pos.x=30; // position restore. + attacker11_pos.y=11; //every attacker ,totally 8 times. + } + else if(attacker11_pos.y > 36) + { + attacker11_pos.x=30; + attacker11_pos.y=11; + } + else if(attacker11_pos.x < 10) + { + attacker11_pos.x=30; + attacker11_pos.y=11; + } + else if(attacker11_pos.x > 72) + { + attacker11_pos.x=30; + attacker11_pos.y=11; + } + + if(attacker22_pos.y < 10) + { + attacker22_pos.x=54; + attacker22_pos.y=10; + } + else if(attacker22_pos.y > 36) + { + attacker22_pos.x=54; + attacker22_pos.y=10; + } + else if(attacker22_pos.x < 10) + { + attacker22_pos.x=54; + attacker22_pos.y=10; + } + else if(attacker22_pos.x > 72) + { + attacker22_pos.x=54; + attacker22_pos.y=10; + } + + if(attacker33_pos.y < 10) + { + attacker33_pos.x=10; + attacker33_pos.y=17; + } + else if(attacker33_pos.y > 36) + { + attacker33_pos.x=10; + attacker33_pos.y=17; + } + else if(attacker33_pos.x < 10) + { + attacker33_pos.x=10; + attacker33_pos.y=17; + } + else if(attacker33_pos.x > 72) + { + attacker33_pos.x=10; + attacker33_pos.y=17; + } + + if(attacker44_pos.y < 10) + { + attacker44_pos.x=10; + attacker44_pos.y=31; + } + else if(attacker44_pos.y > 36) + { + attacker44_pos.x=10; + attacker44_pos.y=31; + } + else if(attacker11_pos.x < 10) + { + attacker44_pos.x=10; + attacker44_pos.y=31; + } + else if(attacker44_pos.x > 72) + { + attacker44_pos.x=10; + attacker44_pos.y=31; + } + + if(attacker55_pos.y < 10) + { + attacker55_pos.x=30; + attacker55_pos.y=36; + } + else if(attacker55_pos.y > 36) + { + attacker55_pos.x=30; + attacker55_pos.y=36; + } + else if(attacker55_pos.x < 10) + { + attacker55_pos.x=30; + attacker55_pos.y=36; + } + else if(attacker55_pos.x > 72) + { + attacker55_pos.x=30; + attacker55_pos.y=36; + } + + if(attacker66_pos.y < 10) + { + attacker66_pos.x=54; + attacker66_pos.y=36; + } + else if(attacker66_pos.y > 36) + { + attacker66_pos.x=54; + attacker66_pos.y=36; + } + else if(attacker66_pos.x < 10) + { + attacker66_pos.x=54; + attacker66_pos.y=36; + } + else if(attacker66_pos.x > 72) + { + attacker66_pos.x=54; + attacker66_pos.y=36; + } + + if(attacker77_pos.y < 10) + { + attacker77_pos.x=71; + attacker77_pos.y=31; + } + else if(attacker77_pos.y > 36) + { + attacker77_pos.x=71; + attacker77_pos.y=31; + } + else if(attacker77_pos.x < 10) + { + attacker77_pos.x=71; + attacker77_pos.y=31; + } + else if(attacker77_pos.x > 72) + { + attacker77_pos.x=71; + attacker77_pos.y=31; + } + + if(attacker88_pos.y < 10) + { + attacker88_pos.x=71; + attacker88_pos.y=17; + } + else if(attacker88_pos.y > 36) + { + attacker88_pos.x=71; + attacker88_pos.y=17; + } + else if(attacker88_pos.x < 10) + { + attacker88_pos.x=71; + attacker88_pos.y=17; + } + else if(attacker88_pos.x > 72) + { + attacker88_pos.x=71; + 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); + +} + + + 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); + +}