Ahmed Adamjee
/
SnakeVSBlock
Snake vs Block Game to be run upon K64F.
Diff: Snake/Snake.cpp
- Revision:
- 13:9785f2404045
- Parent:
- 12:1e601b176437
- Child:
- 16:7b474f873683
--- a/Snake/Snake.cpp Tue Apr 02 17:06:22 2019 +0000 +++ b/Snake/Snake.cpp Wed Apr 03 17:51:19 2019 +0000 @@ -46,7 +46,21 @@ _xl = _xk; _xm = _xl; _xn = _xm; - _y = HEIGHT - 3; + _y = HEIGHT - 3; + _ya = _y-3; + _yb = _y-6; + _yc = _y-9; + _yd = _y-12; + _ye = _y-15; + _yf = _y-18; + _yg = _y-21; + _yh = _y-24; + _yi = _y-27; + _yj = _y-30; + _yk = _y-33; + _yl = _y-36; + _ym = _y-39; + _yn = _y-42; m = m+1; } //printf("SPRITE %d %d \n", _x, _y); @@ -58,150 +72,150 @@ } if(length == 2) { lcd.drawSprite(_x,_y,3,3,(int *)snake_sprite); //Function used to draw the sprite. - lcd.drawSprite(_xa,_y-3,3,3,(int *)snake_sprite); + lcd.drawSprite(_xa,_ya,3,3,(int *)snake_sprite); } if(length == 3) { lcd.drawSprite(_x,_y,3,3,(int *)snake_sprite); //Function used to draw the sprite. - lcd.drawSprite(_xa,_y-3,3,3,(int *)snake_sprite); - lcd.drawSprite(_xb,_y-6,3,3,(int *)snake_sprite); + lcd.drawSprite(_xa,_ya,3,3,(int *)snake_sprite); + lcd.drawSprite(_xb,_yb,3,3,(int *)snake_sprite); } if(length == 4) { lcd.drawSprite(_x,_y,3,3,(int *)snake_sprite); //Function used to draw the sprite. - lcd.drawSprite(_xa,_y-3,3,3,(int *)snake_sprite); - lcd.drawSprite(_xb,_y-6,3,3,(int *)snake_sprite); - lcd.drawSprite(_xc,_y-9,3,3,(int *)snake_sprite); + lcd.drawSprite(_xa,_ya,3,3,(int *)snake_sprite); + lcd.drawSprite(_xb,_yb,3,3,(int *)snake_sprite); + lcd.drawSprite(_xc,_yc,3,3,(int *)snake_sprite); } if(length == 5) { lcd.drawSprite(_x,_y,3,3,(int *)snake_sprite); //Function used to draw the sprite. - lcd.drawSprite(_xa,_y-3,3,3,(int *)snake_sprite); - lcd.drawSprite(_xb,_y-6,3,3,(int *)snake_sprite); - lcd.drawSprite(_xc,_y-9,3,3,(int *)snake_sprite); - lcd.drawSprite(_xd,_y-12,3,3,(int *)snake_sprite); + lcd.drawSprite(_xa,_ya,3,3,(int *)snake_sprite); + lcd.drawSprite(_xb,_yb,3,3,(int *)snake_sprite); + lcd.drawSprite(_xc,_yc,3,3,(int *)snake_sprite); + lcd.drawSprite(_xd,_yd,3,3,(int *)snake_sprite); } if(length == 6) { lcd.drawSprite(_x,_y,3,3,(int *)snake_sprite); //Function used to draw the sprite. - lcd.drawSprite(_xa,_y-3,3,3,(int *)snake_sprite); - lcd.drawSprite(_xb,_y-6,3,3,(int *)snake_sprite); - lcd.drawSprite(_xc,_y-9,3,3,(int *)snake_sprite); - lcd.drawSprite(_xd,_y-12,3,3,(int *)snake_sprite); - lcd.drawSprite(_xe,_y-15,3,3,(int *)snake_sprite); + lcd.drawSprite(_xa,_ya,3,3,(int *)snake_sprite); + lcd.drawSprite(_xb,_yb,3,3,(int *)snake_sprite); + lcd.drawSprite(_xc,_yc,3,3,(int *)snake_sprite); + lcd.drawSprite(_xd,_yd,3,3,(int *)snake_sprite); + lcd.drawSprite(_xe,_ye,3,3,(int *)snake_sprite); } if(length == 7) { lcd.drawSprite(_x,_y,3,3,(int *)snake_sprite); //Function used to draw the sprite. - lcd.drawSprite(_xa,_y-3,3,3,(int *)snake_sprite); - lcd.drawSprite(_xb,_y-6,3,3,(int *)snake_sprite); - lcd.drawSprite(_xc,_y-9,3,3,(int *)snake_sprite); - lcd.drawSprite(_xd,_y-12,3,3,(int *)snake_sprite); - lcd.drawSprite(_xe,_y-15,3,3,(int *)snake_sprite); - lcd.drawSprite(_xf,_y-18,3,3,(int *)snake_sprite); + lcd.drawSprite(_xa,_ya,3,3,(int *)snake_sprite); + lcd.drawSprite(_xb,_yb,3,3,(int *)snake_sprite); + lcd.drawSprite(_xc,_yc,3,3,(int *)snake_sprite); + lcd.drawSprite(_xd,_yd,3,3,(int *)snake_sprite); + lcd.drawSprite(_xe,_ye,3,3,(int *)snake_sprite); + lcd.drawSprite(_xf,_yf,3,3,(int *)snake_sprite); } if(length == 8) { lcd.drawSprite(_x,_y,3,3,(int *)snake_sprite); //Function used to draw the sprite. - lcd.drawSprite(_xa,_y-3,3,3,(int *)snake_sprite); - lcd.drawSprite(_xb,_y-6,3,3,(int *)snake_sprite); - lcd.drawSprite(_xc,_y-9,3,3,(int *)snake_sprite); - lcd.drawSprite(_xd,_y-12,3,3,(int *)snake_sprite); - lcd.drawSprite(_xe,_y-15,3,3,(int *)snake_sprite); - lcd.drawSprite(_xf,_y-18,3,3,(int *)snake_sprite); - lcd.drawSprite(_xg,_y-21,3,3,(int *)snake_sprite); + lcd.drawSprite(_xa,_ya,3,3,(int *)snake_sprite); + lcd.drawSprite(_xb,_yb,3,3,(int *)snake_sprite); + lcd.drawSprite(_xc,_yc,3,3,(int *)snake_sprite); + lcd.drawSprite(_xd,_yd,3,3,(int *)snake_sprite); + lcd.drawSprite(_xe,_ye,3,3,(int *)snake_sprite); + lcd.drawSprite(_xf,_yf,3,3,(int *)snake_sprite); + lcd.drawSprite(_xg,_yg,3,3,(int *)snake_sprite); } if(length == 9) { lcd.drawSprite(_x,_y,3,3,(int *)snake_sprite); //Function used to draw the sprite. - lcd.drawSprite(_xa,_y-3,3,3,(int *)snake_sprite); - lcd.drawSprite(_xb,_y-6,3,3,(int *)snake_sprite); - lcd.drawSprite(_xc,_y-9,3,3,(int *)snake_sprite); - lcd.drawSprite(_xd,_y-12,3,3,(int *)snake_sprite); - lcd.drawSprite(_xe,_y-15,3,3,(int *)snake_sprite); - lcd.drawSprite(_xf,_y-18,3,3,(int *)snake_sprite); - lcd.drawSprite(_xg,_y-21,3,3,(int *)snake_sprite); - lcd.drawSprite(_xh,_y-24,3,3,(int *)snake_sprite); + lcd.drawSprite(_xa,_ya,3,3,(int *)snake_sprite); + lcd.drawSprite(_xb,_yb,3,3,(int *)snake_sprite); + lcd.drawSprite(_xc,_yc,3,3,(int *)snake_sprite); + lcd.drawSprite(_xd,_yd,3,3,(int *)snake_sprite); + lcd.drawSprite(_xe,_ye,3,3,(int *)snake_sprite); + lcd.drawSprite(_xf,_yf,3,3,(int *)snake_sprite); + lcd.drawSprite(_xg,_yg,3,3,(int *)snake_sprite); + lcd.drawSprite(_xh,_yh,3,3,(int *)snake_sprite); } if(length == 10) { lcd.drawSprite(_x,_y,3,3,(int *)snake_sprite); //Function used to draw the sprite. - lcd.drawSprite(_xa,_y-3,3,3,(int *)snake_sprite); - lcd.drawSprite(_xb,_y-6,3,3,(int *)snake_sprite); - lcd.drawSprite(_xc,_y-9,3,3,(int *)snake_sprite); - lcd.drawSprite(_xd,_y-12,3,3,(int *)snake_sprite); - lcd.drawSprite(_xe,_y-15,3,3,(int *)snake_sprite); - lcd.drawSprite(_xf,_y-18,3,3,(int *)snake_sprite); - lcd.drawSprite(_xg,_y-21,3,3,(int *)snake_sprite); - lcd.drawSprite(_xh,_y-24,3,3,(int *)snake_sprite); - lcd.drawSprite(_xi,_y-27,3,3,(int *)snake_sprite); + lcd.drawSprite(_xa,_ya,3,3,(int *)snake_sprite); + lcd.drawSprite(_xb,_yb,3,3,(int *)snake_sprite); + lcd.drawSprite(_xc,_yc,3,3,(int *)snake_sprite); + lcd.drawSprite(_xd,_yd,3,3,(int *)snake_sprite); + lcd.drawSprite(_xe,_ye,3,3,(int *)snake_sprite); + lcd.drawSprite(_xf,_yf,3,3,(int *)snake_sprite); + lcd.drawSprite(_xg,_yg,3,3,(int *)snake_sprite); + lcd.drawSprite(_xh,_yh,3,3,(int *)snake_sprite); + lcd.drawSprite(_xi,_yi,3,3,(int *)snake_sprite); } if(length == 11) { lcd.drawSprite(_x,_y,3,3,(int *)snake_sprite); //Function used to draw the sprite. - lcd.drawSprite(_xa,_y-3,3,3,(int *)snake_sprite); - lcd.drawSprite(_xb,_y-6,3,3,(int *)snake_sprite); - lcd.drawSprite(_xc,_y-9,3,3,(int *)snake_sprite); - lcd.drawSprite(_xd,_y-12,3,3,(int *)snake_sprite); - lcd.drawSprite(_xe,_y-15,3,3,(int *)snake_sprite); - lcd.drawSprite(_xf,_y-18,3,3,(int *)snake_sprite); - lcd.drawSprite(_xg,_y-21,3,3,(int *)snake_sprite); - lcd.drawSprite(_xh,_y-24,3,3,(int *)snake_sprite); - lcd.drawSprite(_xi,_y-27,3,3,(int *)snake_sprite); - lcd.drawSprite(_xj,_y-30,3,3,(int *)snake_sprite); + lcd.drawSprite(_xa,_ya,3,3,(int *)snake_sprite); + lcd.drawSprite(_xb,_yb,3,3,(int *)snake_sprite); + lcd.drawSprite(_xc,_yc,3,3,(int *)snake_sprite); + lcd.drawSprite(_xd,_yd,3,3,(int *)snake_sprite); + lcd.drawSprite(_xe,_ye,3,3,(int *)snake_sprite); + lcd.drawSprite(_xf,_yf,3,3,(int *)snake_sprite); + lcd.drawSprite(_xg,_yg,3,3,(int *)snake_sprite); + lcd.drawSprite(_xh,_yh,3,3,(int *)snake_sprite); + lcd.drawSprite(_xi,_yi,3,3,(int *)snake_sprite); + lcd.drawSprite(_xj,_yj,3,3,(int *)snake_sprite); } if(length == 12) { lcd.drawSprite(_x,_y,3,3,(int *)snake_sprite); //Function used to draw the sprite. - lcd.drawSprite(_xa,_y-3,3,3,(int *)snake_sprite); - lcd.drawSprite(_xb,_y-6,3,3,(int *)snake_sprite); - lcd.drawSprite(_xc,_y-9,3,3,(int *)snake_sprite); - lcd.drawSprite(_xd,_y-12,3,3,(int *)snake_sprite); - lcd.drawSprite(_xe,_y-15,3,3,(int *)snake_sprite); - lcd.drawSprite(_xf,_y-18,3,3,(int *)snake_sprite); - lcd.drawSprite(_xg,_y-21,3,3,(int *)snake_sprite); - lcd.drawSprite(_xh,_y-24,3,3,(int *)snake_sprite); - lcd.drawSprite(_xi,_y-27,3,3,(int *)snake_sprite); - lcd.drawSprite(_xj,_y-30,3,3,(int *)snake_sprite); - lcd.drawSprite(_xk,_y-33,3,3,(int *)snake_sprite); + lcd.drawSprite(_xa,_ya,3,3,(int *)snake_sprite); + lcd.drawSprite(_xb,_yb,3,3,(int *)snake_sprite); + lcd.drawSprite(_xc,_yc,3,3,(int *)snake_sprite); + lcd.drawSprite(_xd,_yd,3,3,(int *)snake_sprite); + lcd.drawSprite(_xe,_ye,3,3,(int *)snake_sprite); + lcd.drawSprite(_xf,_yf,3,3,(int *)snake_sprite); + lcd.drawSprite(_xg,_yg,3,3,(int *)snake_sprite); + lcd.drawSprite(_xh,_yh,3,3,(int *)snake_sprite); + lcd.drawSprite(_xi,_yi,3,3,(int *)snake_sprite); + lcd.drawSprite(_xj,_yj,3,3,(int *)snake_sprite); + lcd.drawSprite(_xk,_yk,3,3,(int *)snake_sprite); } if(length == 13) { lcd.drawSprite(_x,_y,3,3,(int *)snake_sprite); //Function used to draw the sprite. - lcd.drawSprite(_xa,_y-3,3,3,(int *)snake_sprite); - lcd.drawSprite(_xb,_y-6,3,3,(int *)snake_sprite); - lcd.drawSprite(_xc,_y-9,3,3,(int *)snake_sprite); - lcd.drawSprite(_xd,_y-12,3,3,(int *)snake_sprite); - lcd.drawSprite(_xe,_y-15,3,3,(int *)snake_sprite); - lcd.drawSprite(_xf,_y-18,3,3,(int *)snake_sprite); - lcd.drawSprite(_xg,_y-21,3,3,(int *)snake_sprite); - lcd.drawSprite(_xh,_y-24,3,3,(int *)snake_sprite); - lcd.drawSprite(_xi,_y-27,3,3,(int *)snake_sprite); - lcd.drawSprite(_xj,_y-30,3,3,(int *)snake_sprite); - lcd.drawSprite(_xk,_y-33,3,3,(int *)snake_sprite); - lcd.drawSprite(_xl,_y-36,3,3,(int *)snake_sprite); + lcd.drawSprite(_xa,_ya,3,3,(int *)snake_sprite); + lcd.drawSprite(_xb,_yb,3,3,(int *)snake_sprite); + lcd.drawSprite(_xc,_yc,3,3,(int *)snake_sprite); + lcd.drawSprite(_xd,_yd,3,3,(int *)snake_sprite); + lcd.drawSprite(_xe,_ye,3,3,(int *)snake_sprite); + lcd.drawSprite(_xf,_yf,3,3,(int *)snake_sprite); + lcd.drawSprite(_xg,_yg,3,3,(int *)snake_sprite); + lcd.drawSprite(_xh,_yh,3,3,(int *)snake_sprite); + lcd.drawSprite(_xi,_yi,3,3,(int *)snake_sprite); + lcd.drawSprite(_xj,_yj,3,3,(int *)snake_sprite); + lcd.drawSprite(_xk,_yk,3,3,(int *)snake_sprite); + lcd.drawSprite(_xl,_yl,3,3,(int *)snake_sprite); } if(length == 14) { lcd.drawSprite(_x,_y,3,3,(int *)snake_sprite); //Function used to draw the sprite. - lcd.drawSprite(_xa,_y-3,3,3,(int *)snake_sprite); - lcd.drawSprite(_xb,_y-6,3,3,(int *)snake_sprite); - lcd.drawSprite(_xc,_y-9,3,3,(int *)snake_sprite); - lcd.drawSprite(_xd,_y-12,3,3,(int *)snake_sprite); - lcd.drawSprite(_xe,_y-15,3,3,(int *)snake_sprite); - lcd.drawSprite(_xf,_y-18,3,3,(int *)snake_sprite); - lcd.drawSprite(_xg,_y-21,3,3,(int *)snake_sprite); - lcd.drawSprite(_xh,_y-24,3,3,(int *)snake_sprite); - lcd.drawSprite(_xi,_y-27,3,3,(int *)snake_sprite); - lcd.drawSprite(_xj,_y-30,3,3,(int *)snake_sprite); - lcd.drawSprite(_xk,_y-33,3,3,(int *)snake_sprite); - lcd.drawSprite(_xl,_y-36,3,3,(int *)snake_sprite); - lcd.drawSprite(_xm,_y-39,3,3,(int *)snake_sprite); + lcd.drawSprite(_xa,_ya,3,3,(int *)snake_sprite); + lcd.drawSprite(_xb,_yb,3,3,(int *)snake_sprite); + lcd.drawSprite(_xc,_yc,3,3,(int *)snake_sprite); + lcd.drawSprite(_xd,_yd,3,3,(int *)snake_sprite); + lcd.drawSprite(_xe,_ye,3,3,(int *)snake_sprite); + lcd.drawSprite(_xf,_yf,3,3,(int *)snake_sprite); + lcd.drawSprite(_xg,_yg,3,3,(int *)snake_sprite); + lcd.drawSprite(_xh,_yh,3,3,(int *)snake_sprite); + lcd.drawSprite(_xi,_yi,3,3,(int *)snake_sprite); + lcd.drawSprite(_xj,_yj,3,3,(int *)snake_sprite); + lcd.drawSprite(_xk,_yk,3,3,(int *)snake_sprite); + lcd.drawSprite(_xl,_yl,3,3,(int *)snake_sprite); + lcd.drawSprite(_xm,_ym,3,3,(int *)snake_sprite); } if(length == 15) { lcd.drawSprite(_x,_y,3,3,(int *)snake_sprite); //Function used to draw the sprite. - lcd.drawSprite(_xa,_y-3,3,3,(int *)snake_sprite); - lcd.drawSprite(_xb,_y-6,3,3,(int *)snake_sprite); - lcd.drawSprite(_xc,_y-9,3,3,(int *)snake_sprite); - lcd.drawSprite(_xd,_y-12,3,3,(int *)snake_sprite); - lcd.drawSprite(_xe,_y-15,3,3,(int *)snake_sprite); - lcd.drawSprite(_xf,_y-18,3,3,(int *)snake_sprite); - lcd.drawSprite(_xg,_y-21,3,3,(int *)snake_sprite); - lcd.drawSprite(_xh,_y-24,3,3,(int *)snake_sprite); - lcd.drawSprite(_xi,_y-27,3,3,(int *)snake_sprite); - lcd.drawSprite(_xj,_y-30,3,3,(int *)snake_sprite); - lcd.drawSprite(_xk,_y-33,3,3,(int *)snake_sprite); - lcd.drawSprite(_xl,_y-36,3,3,(int *)snake_sprite); - lcd.drawSprite(_xm,_y-39,3,3,(int *)snake_sprite); - lcd.drawSprite(_xn,_y-42,3,3,(int *)snake_sprite); + lcd.drawSprite(_xa,_ya,3,3,(int *)snake_sprite); + lcd.drawSprite(_xb,_yb,3,3,(int *)snake_sprite); + lcd.drawSprite(_xc,_yc,3,3,(int *)snake_sprite); + lcd.drawSprite(_xd,_yd,3,3,(int *)snake_sprite); + lcd.drawSprite(_xe,_ye,3,3,(int *)snake_sprite); + lcd.drawSprite(_xf,_yf,3,3,(int *)snake_sprite); + lcd.drawSprite(_xg,_yg,3,3,(int *)snake_sprite); + lcd.drawSprite(_xh,_yh,3,3,(int *)snake_sprite); + lcd.drawSprite(_xi,_yi,3,3,(int *)snake_sprite); + lcd.drawSprite(_xj,_yj,3,3,(int *)snake_sprite); + lcd.drawSprite(_xk,_yk,3,3,(int *)snake_sprite); + lcd.drawSprite(_xl,_yl,3,3,(int *)snake_sprite); + lcd.drawSprite(_xm,_ym,3,3,(int *)snake_sprite); + lcd.drawSprite(_xn,_yn,3,3,(int *)snake_sprite); } } @@ -213,71 +227,1107 @@ Vector2D snakepos = {_x,_y}; //Obtains the snake position. return snakepos; } - else if(length == 2) { - Vector2D snakepos = {_xa,(_y-3)}; //Obtains the snake position. + Vector2D snakepos = {_xa,_ya}; //Obtains the snake position. return snakepos; } else if(length==3) { - Vector2D snakepos = {_xb,(_y-6)}; //Obtains the snake position. + Vector2D snakepos = {_xb,_yb}; //Obtains the snake position. return snakepos; } else if(length==4) { - Vector2D snakepos = {_xc,(_y-9)}; //Obtains the snake position. + Vector2D snakepos = {_xc,_yc}; //Obtains the snake position. return snakepos; } else if(length==5) { - Vector2D snakepos = {_xd,(_y-12)}; //Obtains the snake position. + Vector2D snakepos = {_xd,_yd}; //Obtains the snake position. return snakepos; } else if(length==6) { - Vector2D snakepos = {_xe,(_y-15)}; //Obtains the snake position. + Vector2D snakepos = {_xe,_ye}; //Obtains the snake position. return snakepos; } else if(length==7) { - Vector2D snakepos = {_xf,(_y-18)}; //Obtains the snake position. + Vector2D snakepos = {_xf,_yf}; //Obtains the snake position. return snakepos; } else if(length==8) { - Vector2D snakepos = {_xg,(_y-21)}; //Obtains the snake position. + Vector2D snakepos = {_xg,_yg}; //Obtains the snake position. return snakepos; } else if(length==9) { - Vector2D snakepos = {_xh,(_y-24)}; //Obtains the snake position. + Vector2D snakepos = {_xh,_yh}; //Obtains the snake position. return snakepos; } else if(length==10) { - Vector2D snakepos = {_xi,(_y-27)}; //Obtains the snake position. + Vector2D snakepos = {_xi,_yi}; //Obtains the snake position. return snakepos; } else if(length==11) { - Vector2D snakepos = {_xj,(_y-30)}; //Obtains the snake position. + Vector2D snakepos = {_xj,_yj}; //Obtains the snake position. return snakepos; } else if(length==12) { - Vector2D snakepos = {_xk,(_y-33)}; //Obtains the snake position. + Vector2D snakepos = {_xk,_yk}; //Obtains the snake position. return snakepos; } else if(length==13) { - Vector2D snakepos = {_xl,(_y-36)}; //Obtains the snake position. + Vector2D snakepos = {_xl,_yl}; //Obtains the snake position. return snakepos; } else if(length == 14) { - Vector2D snakepos = {_xm,(_y-39)}; //Obtains the snake position. + Vector2D snakepos = {_xm,_ym}; //Obtains the snake position. return snakepos; } else if(length==15) { - Vector2D snakepos = {_xn,(_y-42)}; //Obtains the snake position. + Vector2D snakepos = {_xn,_yn}; //Obtains the snake position. return snakepos; } //printf("snakepos from player = %f %f \n", snakepos.x, snakepos.y); - return {0,0}; + else { + Vector2D snakepos = {-20,-20}; //Obtains the snake position. + return snakepos; + } +} + +Vector2D Snake::get_pos_before1(int length) //this sends data of following sprites. +{ + if(length == 1) { + Vector2D snakepos_b1 = {-20,-20}; //Obtains the snake position. + return snakepos_b1; + } + else if(length == 2) { + Vector2D snakepos_b1 = {_x,_y}; //Obtains the snake position. + return snakepos_b1; + } + else if(length==3) { + Vector2D snakepos_b1 = {_xa,_ya}; //Obtains the snake position. + return snakepos_b1; + } + else if(length==4) { + Vector2D snakepos_b1 = {_xb,_yb}; //Obtains the snake position. + return snakepos_b1; + } + else if(length==5) { + Vector2D snakepos_b1 = {_xc,_yc}; //Obtains the snake position. + return snakepos_b1; + } + else if(length==6) { + Vector2D snakepos_b1 = {_xd,_yd}; //Obtains the snake position. + return snakepos_b1; + } + else if(length==7) { + Vector2D snakepos_b1 = {_xe,_ye}; //Obtains the snake position. + return snakepos_b1; + } + else if(length==8) { + Vector2D snakepos_b1 = {_xf,_yf}; //Obtains the snake position. + return snakepos_b1; + } + else if(length==9) { + Vector2D snakepos_b1 = {_xg,_yg}; //Obtains the snake position. + return snakepos_b1; + } + else if(length==10) { + Vector2D snakepos_b1 = {_xh,_yh}; //Obtains the snake position. + return snakepos_b1; + } + else if(length==11) { + Vector2D snakepos_b1 = {_xi,_yi}; //Obtains the snake position. + return snakepos_b1; + } + else if(length==12) { + Vector2D snakepos_b1 = {_xj,_yj}; //Obtains the snake position. + return snakepos_b1; + } + else if(length==13) { + Vector2D snakepos_b1 = {_xk,_yk}; //Obtains the snake position. + return snakepos_b1; + } + else if(length == 14) { + Vector2D snakepos_b1 = {_xl,_yl}; //Obtains the snake position. + return snakepos_b1; + } + else if(length==15) { + Vector2D snakepos_b1 = {_xm,_ym}; //Obtains the snake position. + return snakepos_b1; + } + //printf("snakepos from player = %f %f \n", snakepos.x, snakepos.y); + else { + Vector2D snakepos_b1 = {-20,-20}; //Obtains the snake position. + return snakepos_b1; + } +} + +Vector2D Snake::get_pos_before2(int length) //this sends data of following sprites. +{ + if(length == 1) { + Vector2D snakepos_b2 = {-20,-20}; //Obtains the snake position. + return snakepos_b2; + } + else if(length == 2) { + Vector2D snakepos_b2 = {-20,-20}; //Obtains the snake position. + return snakepos_b2; + } + else if(length == 3) { + Vector2D snakepos_b2 = {_x,_y}; //Obtains the snake position. + return snakepos_b2; + } + else if(length==4) { + Vector2D snakepos_b2 = {_xa,_ya}; //Obtains the snake position. + return snakepos_b2; + } + else if(length==5) { + Vector2D snakepos_b2 = {_xb,_yb}; //Obtains the snake position. + return snakepos_b2; + } + else if(length==6) { + Vector2D snakepos_b2 = {_xc,_yc}; //Obtains the snake position. + return snakepos_b2; + } + else if(length==7) { + Vector2D snakepos_b2 = {_xd,_yd}; //Obtains the snake position. + return snakepos_b2; + } + else if(length==8) { + Vector2D snakepos_b2 = {_xe,_ye}; //Obtains the snake position. + return snakepos_b2; + } + else if(length==9) { + Vector2D snakepos_b2 = {_xf,_yf}; //Obtains the snake position. + return snakepos_b2; + } + else if(length==10) { + Vector2D snakepos_b2 = {_xg,_yg}; //Obtains the snake position. + return snakepos_b2; + } + else if(length==11) { + Vector2D snakepos_b2 = {_xh,_yh}; //Obtains the snake position. + return snakepos_b2; + } + else if(length==12) { + Vector2D snakepos_b2 = {_xi,_yi}; //Obtains the snake position. + return snakepos_b2; + } + else if(length==13) { + Vector2D snakepos_b2 = {_xj,_yj}; //Obtains the snake position. + return snakepos_b2; + } + else if(length==14) { + Vector2D snakepos_b2 = {_xk,_yk}; //Obtains the snake position. + return snakepos_b2; + } + else if(length == 15) { + Vector2D snakepos_b2 = {_xl,_yl}; //Obtains the snake position. + return snakepos_b2; + } + //printf("snakepos from player = %f %f \n", snakepos.x, snakepos.y); + else { + Vector2D snakepos_b2 = {-20,-20}; //Obtains the snake position. + return snakepos_b2; + } +} + +Vector2D Snake::get_pos_before3(int length) //this sends data of following sprites. +{ + if(length == 1) { + Vector2D snakepos_b3 = {-20,-20}; //Obtains the snake position. + return snakepos_b3; + } + else if(length == 2) { + Vector2D snakepos_b3 = {-20,-20}; //Obtains the snake position. + return snakepos_b3; + } + else if(length == 3) { + Vector2D snakepos_b3 = {-20,-20}; //Obtains the snake position. + return snakepos_b3; + } + else if(length == 4) { + Vector2D snakepos_b3 = {_x,_y}; //Obtains the snake position. + return snakepos_b3; + } + else if(length==5) { + Vector2D snakepos_b3 = {_xa,_ya}; //Obtains the snake position. + return snakepos_b3; + } + else if(length==6) { + Vector2D snakepos_b3 = {_xb,_yb}; //Obtains the snake position. + return snakepos_b3; + } + else if(length==7) { + Vector2D snakepos_b3 = {_xc,_yc}; //Obtains the snake position. + return snakepos_b3; + } + else if(length==8) { + Vector2D snakepos_b3 = {_xd,_yd}; //Obtains the snake position. + return snakepos_b3; + } + else if(length==9) { + Vector2D snakepos_b3 = {_xe,_ye}; //Obtains the snake position. + return snakepos_b3; + } + else if(length==10) { + Vector2D snakepos_b3 = {_xf,_yf}; //Obtains the snake position. + return snakepos_b3; + } + else if(length==11) { + Vector2D snakepos_b3 = {_xg,_yg}; //Obtains the snake position. + return snakepos_b3; + } + else if(length==12) { + Vector2D snakepos_b3 = {_xh,_yh}; //Obtains the snake position. + return snakepos_b3; + } + else if(length==13) { + Vector2D snakepos_b3 = {_xi,_yi}; //Obtains the snake position. + return snakepos_b3; + } + else if(length==14) { + Vector2D snakepos_b3 = {_xj,_yj}; //Obtains the snake position. + return snakepos_b3; + } + else if(length==15) { + Vector2D snakepos_b3 = {_xk,_yk}; //Obtains the snake position. + return snakepos_b3; + } + //printf("snakepos from player = %f %f \n", snakepos.x, snakepos.y); + else { + Vector2D snakepos_b3 = {-20,-20}; //Obtains the snake position. + return snakepos_b3; + } +} + +Vector2D Snake::get_pos_before4(int length) //this sends data of following sprites. +{ + if(length == 1) { + Vector2D snakepos_b4 = {-20,-20}; //Obtains the snake position. + return snakepos_b4; + } + else if(length == 2) { + Vector2D snakepos_b4 = {-20,-20}; //Obtains the snake position. + return snakepos_b4; + } + else if(length == 3) { + Vector2D snakepos_b4 = {-20,-20}; //Obtains the snake position. + return snakepos_b4; + } + else if(length == 4) { + Vector2D snakepos_b4 = {-20,-20}; //Obtains the snake position. + return snakepos_b4; + } + else if(length == 5) { + Vector2D snakepos_b4 = {_x,_y}; //Obtains the snake position. + return snakepos_b4; + } + else if(length==6) { + Vector2D snakepos_b4 = {_xa,_ya}; //Obtains the snake position. + return snakepos_b4; + } + else if(length==7) { + Vector2D snakepos_b4 = {_xb,_yb}; //Obtains the snake position. + return snakepos_b4; + } + else if(length==8) { + Vector2D snakepos_b4 = {_xc,_yc}; //Obtains the snake position. + return snakepos_b4; + } + else if(length==9) { + Vector2D snakepos_b4 = {_xd,_yd}; //Obtains the snake position. + return snakepos_b4; + } + else if(length==10) { + Vector2D snakepos_b4 = {_xe,_ye}; //Obtains the snake position. + return snakepos_b4; + } + else if(length==11) { + Vector2D snakepos_b4 = {_xf,_yf}; //Obtains the snake position. + return snakepos_b4; + } + else if(length==12) { + Vector2D snakepos_b4 = {_xg,_yg}; //Obtains the snake position. + return snakepos_b4; + } + else if(length==13) { + Vector2D snakepos_b4 = {_xh,_yh}; //Obtains the snake position. + return snakepos_b4; + } + else if(length==14) { + Vector2D snakepos_b4 = {_xi,_yi}; //Obtains the snake position. + return snakepos_b4; + } + else if(length==15) { + Vector2D snakepos_b4 = {_xj,_yj}; //Obtains the snake position. + return snakepos_b4; + } + //printf("snakepos from player = %f %f \n", snakepos.x, snakepos.y); + else { + Vector2D snakepos_b4 = {-20,-20}; //Obtains the snake position. + return snakepos_b4; + } +} + +Vector2D Snake::get_pos_before5(int length) //this sends data of following sprites. +{ + if(length == 1) { + Vector2D snakepos_b5 = {-20,-20}; //Obtains the snake position. + return snakepos_b5; + } + else if(length == 2) { + Vector2D snakepos_b5 = {-20,-20}; //Obtains the snake position. + return snakepos_b5; + } + else if(length == 3) { + Vector2D snakepos_b5 = {-20,-20}; //Obtains the snake position. + return snakepos_b5; + } + else if(length == 4) { + Vector2D snakepos_b5 = {-20,-20}; //Obtains the snake position. + return snakepos_b5; + } + else if(length == 5) { + Vector2D snakepos_b5 = {-20,-20}; //Obtains the snake position. + return snakepos_b5; + } + else if(length == 6) { + Vector2D snakepos_b5 = {_x,_y}; //Obtains the snake position. + return snakepos_b5; + } + else if(length==7) { + Vector2D snakepos_b5 = {_xa,_ya}; //Obtains the snake position. + return snakepos_b5; + } + else if(length==8) { + Vector2D snakepos_b5 = {_xb,_yb}; //Obtains the snake position. + return snakepos_b5; + } + else if(length==9) { + Vector2D snakepos_b5 = {_xc,_yc}; //Obtains the snake position. + return snakepos_b5; + } + else if(length==10) { + Vector2D snakepos_b5 = {_xd,_yd}; //Obtains the snake position. + return snakepos_b5; + } + else if(length==11) { + Vector2D snakepos_b5 = {_xe,_ye}; //Obtains the snake position. + return snakepos_b5; + } + else if(length==12) { + Vector2D snakepos_b5 = {_xf,_yf}; //Obtains the snake position. + return snakepos_b5; + } + else if(length==13) { + Vector2D snakepos_b5 = {_xg,_yg}; //Obtains the snake position. + return snakepos_b5; + } + else if(length==14) { + Vector2D snakepos_b5 = {_xh,_yh}; //Obtains the snake position. + return snakepos_b5; + } + else if(length==15) { + Vector2D snakepos_b5 = {_xi,_yi}; //Obtains the snake position. + return snakepos_b5; + } + //printf("snakepos from player = %f %f \n", snakepos.x, snakepos.y); + else { + Vector2D snakepos_b5 = {-20,-20}; //Obtains the snake position. + return snakepos_b5; + } +} + +Vector2D Snake::get_pos_before6(int length) //this sends data of following sprites. +{ + if(length == 1) { + Vector2D snakepos_b6 = {-20,-20}; //Obtains the snake position. + return snakepos_b6; + } + else if(length == 2) { + Vector2D snakepos_b6 = {-20,-20}; //Obtains the snake position. + return snakepos_b6; + } + else if(length == 3) { + Vector2D snakepos_b6 = {-20,-20}; //Obtains the snake position. + return snakepos_b6; + } + else if(length == 4) { + Vector2D snakepos_b6 = {-20,-20}; //Obtains the snake position. + return snakepos_b6; + } + else if(length == 5) { + Vector2D snakepos_b6 = {-20,-20}; //Obtains the snake position. + return snakepos_b6; + } + else if(length == 6) { + Vector2D snakepos_b6 = {-20,-20}; //Obtains the snake position. + return snakepos_b6; + } + else if(length == 7) { + Vector2D snakepos_b6 = {_x,_y}; //Obtains the snake position. + return snakepos_b6; + } + else if(length==8) { + Vector2D snakepos_b6 = {_xa,_ya}; //Obtains the snake position. + return snakepos_b6; + } + else if(length==9) { + Vector2D snakepos_b6 = {_xb,_yb}; //Obtains the snake position. + return snakepos_b6; + } + else if(length==10) { + Vector2D snakepos_b6 = {_xc,_yc}; //Obtains the snake position. + return snakepos_b6; + } + else if(length==11) { + Vector2D snakepos_b6 = {_xd,_yd}; //Obtains the snake position. + return snakepos_b6; + } + else if(length==12) { + Vector2D snakepos_b6 = {_xe,_ye}; //Obtains the snake position. + return snakepos_b6; + } + else if(length==13) { + Vector2D snakepos_b6 = {_xf,_yf}; //Obtains the snake position. + return snakepos_b6; + } + else if(length==14) { + Vector2D snakepos_b6 = {_xg,_yg}; //Obtains the snake position. + return snakepos_b6; + } + else if(length==15) { + Vector2D snakepos_b6 = {_xh,_yh}; //Obtains the snake position. + return snakepos_b6; + } + //printf("snakepos from player = %f %f \n", snakepos.x, snakepos.y); + else { + Vector2D snakepos_b6 = {-20,-20}; //Obtains the snake position. + return snakepos_b6; + } +} + +Vector2D Snake::get_pos_before7(int length) //this sends data of following sprites. +{ + if(length == 1) { + Vector2D snakepos_b7 = {-20,-20}; //Obtains the snake position. + return snakepos_b7; + } + else if(length == 2) { + Vector2D snakepos_b7 = {-20,-20}; //Obtains the snake position. + return snakepos_b7; + } + else if(length == 3) { + Vector2D snakepos_b7 = {-20,-20}; //Obtains the snake position. + return snakepos_b7; + } + else if(length == 4) { + Vector2D snakepos_b7 = {-20,-20}; //Obtains the snake position. + return snakepos_b7; + } + else if(length == 5) { + Vector2D snakepos_b7 = {-20,-20}; //Obtains the snake position. + return snakepos_b7; + } + else if(length == 6) { + Vector2D snakepos_b7 = {-20,-20}; //Obtains the snake position. + return snakepos_b7; + } + else if(length == 7) { + Vector2D snakepos_b7 = {-20,-20}; //Obtains the snake position. + return snakepos_b7; + } + else if(length == 8) { + Vector2D snakepos_b7 = {_x,_y}; //Obtains the snake position. + return snakepos_b7; + } + else if(length==9) { + Vector2D snakepos_b7 = {_xa,_ya}; //Obtains the snake position. + return snakepos_b7; + } + else if(length==10) { + Vector2D snakepos_b7 = {_xb,_yb}; //Obtains the snake position. + return snakepos_b7; + } + else if(length==11) { + Vector2D snakepos_b7 = {_xc,_yc}; //Obtains the snake position. + return snakepos_b7; + } + else if(length==12) { + Vector2D snakepos_b7 = {_xd,_yd}; //Obtains the snake position. + return snakepos_b7; + } + else if(length==13) { + Vector2D snakepos_b7 = {_xe,_ye}; //Obtains the snake position. + return snakepos_b7; + } + else if(length==14) { + Vector2D snakepos_b7 = {_xf,_yf}; //Obtains the snake position. + return snakepos_b7; + } + else if(length==15) { + Vector2D snakepos_b7 = {_xg,_yg}; //Obtains the snake position. + return snakepos_b7; + } + //printf("snakepos from player = %f %f \n", snakepos.x, snakepos.y); + else { + Vector2D snakepos_b7 = {-20,-20}; //Obtains the snake position. + return snakepos_b7; + } } +Vector2D Snake::get_pos_before8(int length) //this sends data of following sprites. +{ + if(length == 1) { + Vector2D snakepos_b8 = {-20,-20}; //Obtains the snake position. + return snakepos_b8; + } + else if(length == 2) { + Vector2D snakepos_b8 = {-20,-20}; //Obtains the snake position. + return snakepos_b8; + } + else if(length == 3) { + Vector2D snakepos_b8 = {-20,-20}; //Obtains the snake position. + return snakepos_b8; + } + else if(length == 4) { + Vector2D snakepos_b8 = {-20,-20}; //Obtains the snake position. + return snakepos_b8; + } + else if(length == 5) { + Vector2D snakepos_b8 = {-20,-20}; //Obtains the snake position. + return snakepos_b8; + } + else if(length == 6) { + Vector2D snakepos_b8 = {-20,-20}; //Obtains the snake position. + return snakepos_b8; + } + else if(length == 7) { + Vector2D snakepos_b8 = {-20,-20}; //Obtains the snake position. + return snakepos_b8; + } + else if(length == 8) { + Vector2D snakepos_b8 = {-20,-20}; //Obtains the snake position. + return snakepos_b8; + } + else if(length == 9) { + Vector2D snakepos_b8 = {_x,_y}; //Obtains the snake position. + return snakepos_b8; + } + else if(length==10) { + Vector2D snakepos_b8 = {_xa,_ya}; //Obtains the snake position. + return snakepos_b8; + } + else if(length==11) { + Vector2D snakepos_b8 = {_xb,_yb}; //Obtains the snake position. + return snakepos_b8; + } + else if(length==12) { + Vector2D snakepos_b8 = {_xc,_yc}; //Obtains the snake position. + return snakepos_b8; + } + else if(length==13) { + Vector2D snakepos_b8 = {_xd,_yd}; //Obtains the snake position. + return snakepos_b8; + } + else if(length==14) { + Vector2D snakepos_b8 = {_xe,_ye}; //Obtains the snake position. + return snakepos_b8; + } + else if(length==15) { + Vector2D snakepos_b8 = {_xf,_yf}; //Obtains the snake position. + return snakepos_b8; + } + //printf("snakepos from player = %f %f \n", snakepos.x, snakepos.y); + else { + Vector2D snakepos_b8 = {-20,-20}; //Obtains the snake position. + return snakepos_b8; + } +} -void Snake::update(Direction d,float mag,int length) +Vector2D Snake::get_pos_before9(int length) //this sends data of following sprites. +{ + if(length == 1) { + Vector2D snakepos_b9 = {-20,-20}; //Obtains the snake position. + return snakepos_b9; + } + else if(length == 2) { + Vector2D snakepos_b9 = {-20,-20}; //Obtains the snake position. + return snakepos_b9; + } + else if(length == 3) { + Vector2D snakepos_b9 = {-20,-20}; //Obtains the snake position. + return snakepos_b9; + } + else if(length == 4) { + Vector2D snakepos_b9 = {-20,-20}; //Obtains the snake position. + return snakepos_b9; + } + else if(length == 5) { + Vector2D snakepos_b9 = {-20,-20}; //Obtains the snake position. + return snakepos_b9; + } + else if(length == 6) { + Vector2D snakepos_b9 = {-20,-20}; //Obtains the snake position. + return snakepos_b9; + } + else if(length == 7) { + Vector2D snakepos_b9 = {-20,-20}; //Obtains the snake position. + return snakepos_b9; + } + else if(length == 8) { + Vector2D snakepos_b9 = {-20,-20}; //Obtains the snake position. + return snakepos_b9; + } + else if(length == 9) { + Vector2D snakepos_b9 = {-20,-20}; //Obtains the snake position. + return snakepos_b9; + } + else if(length == 10) { + Vector2D snakepos_b9 = {_x,_y}; //Obtains the snake position. + return snakepos_b9; + } + else if(length==11) { + Vector2D snakepos_b9 = {_xa,_ya}; //Obtains the snake position. + return snakepos_b9; + } + else if(length==12) { + Vector2D snakepos_b9 = {_xb,_yb}; //Obtains the snake position. + return snakepos_b9; + } + else if(length==13) { + Vector2D snakepos_b9 = {_xc,_yc}; //Obtains the snake position. + return snakepos_b9; + } + else if(length==14) { + Vector2D snakepos_b9 = {_xd,_yd}; //Obtains the snake position. + return snakepos_b9; + } + else if(length==15) { + Vector2D snakepos_b9 = {_xe,_ye}; //Obtains the snake position. + return snakepos_b9; + } + //printf("snakepos from player = %f %f \n", snakepos.x, snakepos.y); + else { + Vector2D snakepos_b9 = {-20,-20}; //Obtains the snake position. + return snakepos_b9; + } +} + +Vector2D Snake::get_pos_before10(int length) //this sends data of following sprites. +{ + if(length == 1) { + Vector2D snakepos_b10 = {-20,-20}; //Obtains the snake position. + return snakepos_b10; + } + else if(length == 2) { + Vector2D snakepos_b10 = {-20,-20}; //Obtains the snake position. + return snakepos_b10; + } + else if(length == 3) { + Vector2D snakepos_b10 = {-20,-20}; //Obtains the snake position. + return snakepos_b10; + } + else if(length == 4) { + Vector2D snakepos_b10 = {-20,-20}; //Obtains the snake position. + return snakepos_b10; + } + else if(length == 5) { + Vector2D snakepos_b10 = {-20,-20}; //Obtains the snake position. + return snakepos_b10; + } + else if(length == 6) { + Vector2D snakepos_b10 = {-20,-20}; //Obtains the snake position. + return snakepos_b10; + } + else if(length == 7) { + Vector2D snakepos_b10 = {-20,-20}; //Obtains the snake position. + return snakepos_b10; + } + else if(length == 8) { + Vector2D snakepos_b10 = {-20,-20}; //Obtains the snake position. + return snakepos_b10; + } + else if(length == 9) { + Vector2D snakepos_b10 = {-20,-20}; //Obtains the snake position. + return snakepos_b10; + } + else if(length == 10) { + Vector2D snakepos_b10 = {-20,-20}; //Obtains the snake position. + return snakepos_b10; + } + else if(length == 11) { + Vector2D snakepos_b10 = {_x,_y}; //Obtains the snake position. + return snakepos_b10; + } + else if(length==12) { + Vector2D snakepos_b10 = {_xa,_ya}; //Obtains the snake position. + return snakepos_b10; + } + else if(length==13) { + Vector2D snakepos_b10 = {_xb,_yb}; //Obtains the snake position. + return snakepos_b10; + } + else if(length==14) { + Vector2D snakepos_b10 = {_xc,_yc}; //Obtains the snake position. + return snakepos_b10; + } + else if(length==15) { + Vector2D snakepos_b10 = {_xd,_yd}; //Obtains the snake position. + return snakepos_b10; + } + //printf("snakepos from player = %f %f \n", snakepos.x, snakepos.y); + else { + Vector2D snakepos_b10 = {-20,-20}; //Obtains the snake position. + return snakepos_b10; + } +} + +Vector2D Snake::get_pos_before11(int length) //this sends data of following sprites. +{ + if(length == 1) { + Vector2D snakepos_b11 = {-20,-20}; //Obtains the snake position. + return snakepos_b11; + } + else if(length == 2) { + Vector2D snakepos_b11 = {-20,-20}; //Obtains the snake position. + return snakepos_b11; + } + else if(length == 3) { + Vector2D snakepos_b11 = {-20,-20}; //Obtains the snake position. + return snakepos_b11; + } + else if(length == 4) { + Vector2D snakepos_b11 = {-20,-20}; //Obtains the snake position. + return snakepos_b11; + } + else if(length == 5) { + Vector2D snakepos_b11 = {-20,-20}; //Obtains the snake position. + return snakepos_b11; + } + else if(length == 6) { + Vector2D snakepos_b11 = {-20,-20}; //Obtains the snake position. + return snakepos_b11; + } + else if(length == 7) { + Vector2D snakepos_b11 = {-20,-20}; //Obtains the snake position. + return snakepos_b11; + } + else if(length == 8) { + Vector2D snakepos_b11 = {-20,-20}; //Obtains the snake position. + return snakepos_b11; + } + else if(length == 9) { + Vector2D snakepos_b11 = {-20,-20}; //Obtains the snake position. + return snakepos_b11; + } + else if(length == 10) { + Vector2D snakepos_b11 = {-20,-20}; //Obtains the snake position. + return snakepos_b11; + } + else if(length == 11) { + Vector2D snakepos_b11 = {-20,-20}; //Obtains the snake position. + return snakepos_b11; + } + else if(length == 12) { + Vector2D snakepos_b11 = {_x,_y}; //Obtains the snake position. + return snakepos_b11; + } + else if(length==13) { + Vector2D snakepos_b11 = {_xa,_ya}; //Obtains the snake position. + return snakepos_b11; + } + else if(length==14) { + Vector2D snakepos_b11 = {_xb,_yb}; //Obtains the snake position. + return snakepos_b11; + } + else if(length==15) { + Vector2D snakepos_b11 = {_xc,_yc}; //Obtains the snake position. + return snakepos_b11; + } + //printf("snakepos from player = %f %f \n", snakepos.x, snakepos.y); + else { + Vector2D snakepos_b11 = {-20,-20}; //Obtains the snake position. + return snakepos_b11; + } +} + +Vector2D Snake::get_pos_before12(int length) //this sends data of following sprites. { - _speed = 1; //Speed changes depending on how much you push the joystick.(As Of Now) + if(length == 1) { + Vector2D snakepos_b12 = {-20,-20}; //Obtains the snake position. + return snakepos_b12; + } + else if(length == 2) { + Vector2D snakepos_b12 = {-20,-20}; //Obtains the snake position. + return snakepos_b12; + } + else if(length == 3) { + Vector2D snakepos_b12 = {-20,-20}; //Obtains the snake position. + return snakepos_b12; + } + else if(length == 4) { + Vector2D snakepos_b12 = {-20,-20}; //Obtains the snake position. + return snakepos_b12; + } + else if(length == 5) { + Vector2D snakepos_b12 = {-20,-20}; //Obtains the snake position. + return snakepos_b12; + } + else if(length == 6) { + Vector2D snakepos_b12 = {-20,-20}; //Obtains the snake position. + return snakepos_b12; + } + else if(length == 7) { + Vector2D snakepos_b12 = {-20,-20}; //Obtains the snake position. + return snakepos_b12; + } + else if(length == 8) { + Vector2D snakepos_b12 = {-20,-20}; //Obtains the snake position. + return snakepos_b12; + } + else if(length == 9) { + Vector2D snakepos_b12 = {-20,-20}; //Obtains the snake position. + return snakepos_b12; + } + else if(length == 10) { + Vector2D snakepos_b12 = {-20,-20}; //Obtains the snake position. + return snakepos_b12; + } + else if(length == 11) { + Vector2D snakepos_b12 = {-20,-20}; //Obtains the snake position. + return snakepos_b12; + } + else if(length == 12) { + Vector2D snakepos_b12 = {-20,-20}; //Obtains the snake position. + return snakepos_b12; + } + else if(length == 13) { + Vector2D snakepos_b12 = {_x,_y}; //Obtains the snake position. + return snakepos_b12; + } + else if(length==14) { + Vector2D snakepos_b12 = {_xa,_ya}; //Obtains the snake position. + return snakepos_b12; + } + else if(length==15) { + Vector2D snakepos_b12 = {_xb,_yb}; //Obtains the snake position. + return snakepos_b12; + } + //printf("snakepos from player = %f %f \n", snakepos.x, snakepos.y); + else { + Vector2D snakepos_b12 = {-20,-20}; //Obtains the snake position. + return snakepos_b12; + } +} + +Vector2D Snake::get_pos_before13(int length) //this sends data of following sprites. +{ + if(length == 1) { + Vector2D snakepos_b13 = {-20,-20}; //Obtains the snake position. + return snakepos_b13; + } + else if(length == 2) { + Vector2D snakepos_b13 = {-20,-20}; //Obtains the snake position. + return snakepos_b13; + } + else if(length == 3) { + Vector2D snakepos_b13 = {-20,-20}; //Obtains the snake position. + return snakepos_b13; + } + else if(length == 4) { + Vector2D snakepos_b13 = {-20,-20}; //Obtains the snake position. + return snakepos_b13; + } + else if(length == 5) { + Vector2D snakepos_b13 = {-20,-20}; //Obtains the snake position. + return snakepos_b13; + } + else if(length == 6) { + Vector2D snakepos_b13 = {-20,-20}; //Obtains the snake position. + return snakepos_b13; + } + else if(length == 7) { + Vector2D snakepos_b13 = {-20,-20}; //Obtains the snake position. + return snakepos_b13; + } + else if(length == 8) { + Vector2D snakepos_b13 = {-20,-20}; //Obtains the snake position. + return snakepos_b13; + } + else if(length == 9) { + Vector2D snakepos_b13 = {-20,-20}; //Obtains the snake position. + return snakepos_b13; + } + else if(length == 10) { + Vector2D snakepos_b13 = {-20,-20}; //Obtains the snake position. + return snakepos_b13; + } + else if(length == 11) { + Vector2D snakepos_b13 = {-20,-20}; //Obtains the snake position. + return snakepos_b13; + } + else if(length == 12) { + Vector2D snakepos_b13 = {-20,-20}; //Obtains the snake position. + return snakepos_b13; + } + else if(length == 13) { + Vector2D snakepos_b13 = {-20,-20}; //Obtains the snake position. + return snakepos_b13; + } + else if(length == 14) { + Vector2D snakepos_b13 = {_x,_y}; //Obtains the snake position. + return snakepos_b13; + } + else if(length==15) { + Vector2D snakepos_b13 = {_xa,_ya}; //Obtains the snake position. + return snakepos_b13; + } + //printf("snakepos from player = %f %f \n", snakepos.x, snakepos.y); + else { + Vector2D snakepos_b13 = {-20,-20}; //Obtains the snake position. + return snakepos_b13; + } +} + +Vector2D Snake::get_pos_before14(int length) //this sends data of following sprites. +{ + if(length == 1) { + Vector2D snakepos_b14 = {-20,-20}; //Obtains the snake position. + return snakepos_b14; + } + else if(length == 2) { + Vector2D snakepos_b14 = {-20,-20}; //Obtains the snake position. + return snakepos_b14; + } + else if(length == 3) { + Vector2D snakepos_b14 = {-20,-20}; //Obtains the snake position. + return snakepos_b14; + } + else if(length == 4) { + Vector2D snakepos_b14 = {-20,-20}; //Obtains the snake position. + return snakepos_b14; + } + else if(length == 5) { + Vector2D snakepos_b14 = {-20,-20}; //Obtains the snake position. + return snakepos_b14; + } + else if(length == 6) { + Vector2D snakepos_b14 = {-20,-20}; //Obtains the snake position. + return snakepos_b14; + } + else if(length == 7) { + Vector2D snakepos_b14 = {-20,-20}; //Obtains the snake position. + return snakepos_b14; + } + else if(length == 8) { + Vector2D snakepos_b14 = {-20,-20}; //Obtains the snake position. + return snakepos_b14; + } + else if(length == 9) { + Vector2D snakepos_b14 = {-20,-20}; //Obtains the snake position. + return snakepos_b14; + } + else if(length == 10) { + Vector2D snakepos_b14 = {-20,-20}; //Obtains the snake position. + return snakepos_b14; + } + else if(length == 11) { + Vector2D snakepos_b14 = {-20,-20}; //Obtains the snake position. + return snakepos_b14; + } + else if(length == 12) { + Vector2D snakepos_b14 = {-20,-20}; //Obtains the snake position. + return snakepos_b14; + } + else if(length == 13) { + Vector2D snakepos_b14 = {-20,-20}; //Obtains the snake position. + return snakepos_b14; + } + else if(length == 14) { + Vector2D snakepos_b14 = {-20,-20}; //Obtains the snake position. + return snakepos_b14; + } + else if(length==15) { + Vector2D snakepos_b14 = {_x,_y}; //Obtains the snake position. + return snakepos_b14; + } + //printf("snakepos from player = %f %f \n", snakepos.x, snakepos.y); + else { + Vector2D snakepos_b14 = {-20,-20}; //Obtains the snake position. + return snakepos_b14; + } +} + +Vector2D Snake::get_pos_before15(int length) //this sends data of following sprites. +{ + if(length == 1) { + Vector2D snakepos_b15 = {-20,-20}; //Obtains the snake position. + return snakepos_b15; + } + else if(length == 2) { + Vector2D snakepos_b15 = {-20,-20}; //Obtains the snake position. + return snakepos_b15; + } + else if(length == 3) { + Vector2D snakepos_b15 = {-20,-20}; //Obtains the snake position. + return snakepos_b15; + } + else if(length == 4) { + Vector2D snakepos_b15 = {-20,-20}; //Obtains the snake position. + return snakepos_b15; + } + else if(length == 5) { + Vector2D snakepos_b15 = {-20,-20}; //Obtains the snake position. + return snakepos_b15; + } + else if(length == 6) { + Vector2D snakepos_b15 = {-20,-20}; //Obtains the snake position. + return snakepos_b15; + } + else if(length == 7) { + Vector2D snakepos_b15 = {-20,-20}; //Obtains the snake position. + return snakepos_b15; + } + else if(length == 8) { + Vector2D snakepos_b15 = {-20,-20}; //Obtains the snake position. + return snakepos_b15; + } + else if(length == 9) { + Vector2D snakepos_b15 = {-20,-20}; //Obtains the snake position. + return snakepos_b15; + } + else if(length == 10) { + Vector2D snakepos_b15 = {-20,-20}; //Obtains the snake position. + return snakepos_b15; + } + else if(length == 11) { + Vector2D snakepos_b15 = {-20,-20}; //Obtains the snake position. + return snakepos_b15; + } + else if(length == 12) { + Vector2D snakepos_b15 = {-20,-20}; //Obtains the snake position. + return snakepos_b15; + } + else if(length == 13) { + Vector2D snakepos_b15 = {-20,-20}; //Obtains the snake position. + return snakepos_b15; + } + else if(length == 14) { + Vector2D snakepos_b15 = {-20,-20}; //Obtains the snake position. + return snakepos_b15; + } + else if(length == 15) { + Vector2D snakepos_b15 = {-20,-20}; //Obtains the snake position. + return snakepos_b15; + } + //printf("snakepos from player = %f %f \n", snakepos.x, snakepos.y); + else { + Vector2D snakepos_b15 = {-20,-20}; //Obtains the snake position. + return snakepos_b15; + } +} + +void Snake::update(Direction d,float mag,int length, int speed) +{ + _speed = speed; //Speed changes depending on how much you push the joystick.(As Of Now) if(length > 1) { if (_x > _xa) {