![](/media/cache/profiles/LinkedIn_0NghoZJ.jpeg.50x50_q85.jpg)
Snake vs Block Game to be run upon K64F.
Snake/Snake.cpp@18:b391caa5754c, 2019-04-08 (annotated)
- Committer:
- AhmedPlaymaker
- Date:
- Mon Apr 08 05:57:04 2019 +0000
- Revision:
- 18:b391caa5754c
- Parent:
- 17:54e13faeaf64
- Child:
- 19:05cc9f801468
Dont know if this is the best way? but this makes the game easier to operate near the edges but makes the snake look distorted
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
AhmedPlaymaker | 7:48ba87cd79b5 | 1 | #include "Snake.h" |
AhmedPlaymaker | 7:48ba87cd79b5 | 2 | |
AhmedPlaymaker | 7:48ba87cd79b5 | 3 | Snake::Snake() |
AhmedPlaymaker | 7:48ba87cd79b5 | 4 | { |
AhmedPlaymaker | 7:48ba87cd79b5 | 5 | |
AhmedPlaymaker | 7:48ba87cd79b5 | 6 | } |
AhmedPlaymaker | 7:48ba87cd79b5 | 7 | |
AhmedPlaymaker | 7:48ba87cd79b5 | 8 | Snake::~Snake() |
AhmedPlaymaker | 7:48ba87cd79b5 | 9 | { |
AhmedPlaymaker | 7:48ba87cd79b5 | 10 | |
AhmedPlaymaker | 7:48ba87cd79b5 | 11 | } |
AhmedPlaymaker | 7:48ba87cd79b5 | 12 | |
AhmedPlaymaker | 7:48ba87cd79b5 | 13 | //The Snake Sprite. |
AhmedPlaymaker | 8:890b986b16a4 | 14 | int snake_sprite[3][3] = { |
AhmedPlaymaker | 8:890b986b16a4 | 15 | {0,1,0}, |
AhmedPlaymaker | 8:890b986b16a4 | 16 | {1,0,1}, |
AhmedPlaymaker | 8:890b986b16a4 | 17 | {0,1,0}, |
AhmedPlaymaker | 9:d1d79d4ee673 | 18 | }; |
AhmedPlaymaker | 7:48ba87cd79b5 | 19 | |
AhmedPlaymaker | 7:48ba87cd79b5 | 20 | int m = 0; //Variable used to allow a starting location for the player. |
AhmedPlaymaker | 7:48ba87cd79b5 | 21 | |
AhmedPlaymaker | 7:48ba87cd79b5 | 22 | |
AhmedPlaymaker | 7:48ba87cd79b5 | 23 | void Snake::init() |
AhmedPlaymaker | 7:48ba87cd79b5 | 24 | { |
AhmedPlaymaker | 7:48ba87cd79b5 | 25 | |
AhmedPlaymaker | 18:b391caa5754c | 26 | _speed = 1;// change this according to the options selected |
AhmedPlaymaker | 7:48ba87cd79b5 | 27 | |
AhmedPlaymaker | 7:48ba87cd79b5 | 28 | } |
AhmedPlaymaker | 7:48ba87cd79b5 | 29 | |
AhmedPlaymaker | 7:48ba87cd79b5 | 30 | |
AhmedPlaymaker | 17:54e13faeaf64 | 31 | int Snake::draw(Gamepad &pad, N5110 &lcd, int length) |
AhmedPlaymaker | 7:48ba87cd79b5 | 32 | { |
AhmedPlaymaker | 7:48ba87cd79b5 | 33 | if(m == 0){ |
AhmedPlaymaker | 7:48ba87cd79b5 | 34 | _x = WIDTH/2; //Spawns player sprite near the middle of the screen. |
AhmedPlaymaker | 8:890b986b16a4 | 35 | _xa = _x; |
AhmedPlaymaker | 9:d1d79d4ee673 | 36 | _xb = _xa; |
AhmedPlaymaker | 9:d1d79d4ee673 | 37 | _xc = _xb; |
AhmedPlaymaker | 9:d1d79d4ee673 | 38 | _xd = _xc; |
AhmedPlaymaker | 9:d1d79d4ee673 | 39 | _xe = _xd; |
AhmedPlaymaker | 9:d1d79d4ee673 | 40 | _xf = _xe; |
AhmedPlaymaker | 9:d1d79d4ee673 | 41 | _xg = _xf; |
AhmedPlaymaker | 9:d1d79d4ee673 | 42 | _xh = _xg; |
AhmedPlaymaker | 9:d1d79d4ee673 | 43 | _xi = _xh; |
AhmedPlaymaker | 9:d1d79d4ee673 | 44 | _xj = _xi; |
AhmedPlaymaker | 9:d1d79d4ee673 | 45 | _xk = _xj; |
AhmedPlaymaker | 9:d1d79d4ee673 | 46 | _xl = _xk; |
AhmedPlaymaker | 9:d1d79d4ee673 | 47 | _xm = _xl; |
AhmedPlaymaker | 9:d1d79d4ee673 | 48 | _xn = _xm; |
AhmedPlaymaker | 13:9785f2404045 | 49 | _y = HEIGHT - 3; |
AhmedPlaymaker | 13:9785f2404045 | 50 | _ya = _y-3; |
AhmedPlaymaker | 13:9785f2404045 | 51 | _yb = _y-6; |
AhmedPlaymaker | 13:9785f2404045 | 52 | _yc = _y-9; |
AhmedPlaymaker | 13:9785f2404045 | 53 | _yd = _y-12; |
AhmedPlaymaker | 13:9785f2404045 | 54 | _ye = _y-15; |
AhmedPlaymaker | 13:9785f2404045 | 55 | _yf = _y-18; |
AhmedPlaymaker | 13:9785f2404045 | 56 | _yg = _y-21; |
AhmedPlaymaker | 13:9785f2404045 | 57 | _yh = _y-24; |
AhmedPlaymaker | 13:9785f2404045 | 58 | _yi = _y-27; |
AhmedPlaymaker | 13:9785f2404045 | 59 | _yj = _y-30; |
AhmedPlaymaker | 13:9785f2404045 | 60 | _yk = _y-33; |
AhmedPlaymaker | 13:9785f2404045 | 61 | _yl = _y-36; |
AhmedPlaymaker | 13:9785f2404045 | 62 | _ym = _y-39; |
AhmedPlaymaker | 18:b391caa5754c | 63 | _yn = _y-42; |
AhmedPlaymaker | 18:b391caa5754c | 64 | b0 = 1; |
AhmedPlaymaker | 18:b391caa5754c | 65 | b1 = 1; |
AhmedPlaymaker | 18:b391caa5754c | 66 | b2 = 1; |
AhmedPlaymaker | 18:b391caa5754c | 67 | b3 = 1; |
AhmedPlaymaker | 18:b391caa5754c | 68 | b4 = 1; |
AhmedPlaymaker | 18:b391caa5754c | 69 | b5 = 1; |
AhmedPlaymaker | 18:b391caa5754c | 70 | b6 = 1; |
AhmedPlaymaker | 18:b391caa5754c | 71 | b7 = 1; |
AhmedPlaymaker | 18:b391caa5754c | 72 | b8 = 1; |
AhmedPlaymaker | 18:b391caa5754c | 73 | b9 = 1; |
AhmedPlaymaker | 18:b391caa5754c | 74 | b10 = 1; |
AhmedPlaymaker | 18:b391caa5754c | 75 | b11 = 1; |
AhmedPlaymaker | 18:b391caa5754c | 76 | b12 = 1; |
AhmedPlaymaker | 18:b391caa5754c | 77 | b13 = 1; |
AhmedPlaymaker | 18:b391caa5754c | 78 | b14 = 1; |
AhmedPlaymaker | 7:48ba87cd79b5 | 79 | m = m+1; |
AhmedPlaymaker | 7:48ba87cd79b5 | 80 | } |
AhmedPlaymaker | 7:48ba87cd79b5 | 81 | //printf("SPRITE %d %d \n", _x, _y); |
AhmedPlaymaker | 8:890b986b16a4 | 82 | if(length == 0) { |
AhmedPlaymaker | 16:7b474f873683 | 83 | while ((pad.check_event(Gamepad::BACK_PRESSED) == false)) { |
AhmedPlaymaker | 16:7b474f873683 | 84 | lcd.clear(); |
AhmedPlaymaker | 16:7b474f873683 | 85 | lcd.printString("Game",33,1); |
AhmedPlaymaker | 16:7b474f873683 | 86 | lcd.printString("Over",33,3); |
AhmedPlaymaker | 16:7b474f873683 | 87 | lcd.printString("Press Back",14,5); //Function used to promt the user to Restart. |
AhmedPlaymaker | 16:7b474f873683 | 88 | lcd.refresh(); |
AhmedPlaymaker | 16:7b474f873683 | 89 | wait(0.1); |
AhmedPlaymaker | 16:7b474f873683 | 90 | } |
AhmedPlaymaker | 16:7b474f873683 | 91 | NVIC_SystemReset(); //Software Reset. //change this condition to loosing screen. |
AhmedPlaymaker | 8:890b986b16a4 | 92 | } |
AhmedPlaymaker | 16:7b474f873683 | 93 | else if(length == 1) { |
AhmedPlaymaker | 8:890b986b16a4 | 94 | lcd.drawSprite(_x,_y,3,3,(int *)snake_sprite); //Function used to draw the sprite. |
AhmedPlaymaker | 8:890b986b16a4 | 95 | } |
AhmedPlaymaker | 16:7b474f873683 | 96 | else if(length == 2) { |
AhmedPlaymaker | 8:890b986b16a4 | 97 | lcd.drawSprite(_x,_y,3,3,(int *)snake_sprite); //Function used to draw the sprite. |
AhmedPlaymaker | 13:9785f2404045 | 98 | lcd.drawSprite(_xa,_ya,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 8:890b986b16a4 | 99 | } |
AhmedPlaymaker | 16:7b474f873683 | 100 | else if(length == 3) { |
AhmedPlaymaker | 8:890b986b16a4 | 101 | lcd.drawSprite(_x,_y,3,3,(int *)snake_sprite); //Function used to draw the sprite. |
AhmedPlaymaker | 13:9785f2404045 | 102 | lcd.drawSprite(_xa,_ya,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 13:9785f2404045 | 103 | lcd.drawSprite(_xb,_yb,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 8:890b986b16a4 | 104 | } |
AhmedPlaymaker | 16:7b474f873683 | 105 | else if(length == 4) { |
AhmedPlaymaker | 8:890b986b16a4 | 106 | lcd.drawSprite(_x,_y,3,3,(int *)snake_sprite); //Function used to draw the sprite. |
AhmedPlaymaker | 13:9785f2404045 | 107 | lcd.drawSprite(_xa,_ya,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 13:9785f2404045 | 108 | lcd.drawSprite(_xb,_yb,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 13:9785f2404045 | 109 | lcd.drawSprite(_xc,_yc,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 8:890b986b16a4 | 110 | } |
AhmedPlaymaker | 16:7b474f873683 | 111 | else if(length == 5) { |
AhmedPlaymaker | 8:890b986b16a4 | 112 | lcd.drawSprite(_x,_y,3,3,(int *)snake_sprite); //Function used to draw the sprite. |
AhmedPlaymaker | 13:9785f2404045 | 113 | lcd.drawSprite(_xa,_ya,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 13:9785f2404045 | 114 | lcd.drawSprite(_xb,_yb,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 13:9785f2404045 | 115 | lcd.drawSprite(_xc,_yc,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 13:9785f2404045 | 116 | lcd.drawSprite(_xd,_yd,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 8:890b986b16a4 | 117 | } |
AhmedPlaymaker | 16:7b474f873683 | 118 | else if(length == 6) { |
AhmedPlaymaker | 8:890b986b16a4 | 119 | lcd.drawSprite(_x,_y,3,3,(int *)snake_sprite); //Function used to draw the sprite. |
AhmedPlaymaker | 13:9785f2404045 | 120 | lcd.drawSprite(_xa,_ya,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 13:9785f2404045 | 121 | lcd.drawSprite(_xb,_yb,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 13:9785f2404045 | 122 | lcd.drawSprite(_xc,_yc,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 13:9785f2404045 | 123 | lcd.drawSprite(_xd,_yd,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 13:9785f2404045 | 124 | lcd.drawSprite(_xe,_ye,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 8:890b986b16a4 | 125 | } |
AhmedPlaymaker | 16:7b474f873683 | 126 | else if(length == 7) { |
AhmedPlaymaker | 8:890b986b16a4 | 127 | lcd.drawSprite(_x,_y,3,3,(int *)snake_sprite); //Function used to draw the sprite. |
AhmedPlaymaker | 13:9785f2404045 | 128 | lcd.drawSprite(_xa,_ya,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 13:9785f2404045 | 129 | lcd.drawSprite(_xb,_yb,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 13:9785f2404045 | 130 | lcd.drawSprite(_xc,_yc,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 13:9785f2404045 | 131 | lcd.drawSprite(_xd,_yd,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 13:9785f2404045 | 132 | lcd.drawSprite(_xe,_ye,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 13:9785f2404045 | 133 | lcd.drawSprite(_xf,_yf,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 8:890b986b16a4 | 134 | } |
AhmedPlaymaker | 16:7b474f873683 | 135 | else if(length == 8) { |
AhmedPlaymaker | 8:890b986b16a4 | 136 | lcd.drawSprite(_x,_y,3,3,(int *)snake_sprite); //Function used to draw the sprite. |
AhmedPlaymaker | 13:9785f2404045 | 137 | lcd.drawSprite(_xa,_ya,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 13:9785f2404045 | 138 | lcd.drawSprite(_xb,_yb,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 13:9785f2404045 | 139 | lcd.drawSprite(_xc,_yc,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 13:9785f2404045 | 140 | lcd.drawSprite(_xd,_yd,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 13:9785f2404045 | 141 | lcd.drawSprite(_xe,_ye,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 13:9785f2404045 | 142 | lcd.drawSprite(_xf,_yf,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 13:9785f2404045 | 143 | lcd.drawSprite(_xg,_yg,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 8:890b986b16a4 | 144 | } |
AhmedPlaymaker | 16:7b474f873683 | 145 | else if(length == 9) { |
AhmedPlaymaker | 8:890b986b16a4 | 146 | lcd.drawSprite(_x,_y,3,3,(int *)snake_sprite); //Function used to draw the sprite. |
AhmedPlaymaker | 13:9785f2404045 | 147 | lcd.drawSprite(_xa,_ya,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 13:9785f2404045 | 148 | lcd.drawSprite(_xb,_yb,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 13:9785f2404045 | 149 | lcd.drawSprite(_xc,_yc,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 13:9785f2404045 | 150 | lcd.drawSprite(_xd,_yd,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 13:9785f2404045 | 151 | lcd.drawSprite(_xe,_ye,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 13:9785f2404045 | 152 | lcd.drawSprite(_xf,_yf,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 13:9785f2404045 | 153 | lcd.drawSprite(_xg,_yg,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 13:9785f2404045 | 154 | lcd.drawSprite(_xh,_yh,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 8:890b986b16a4 | 155 | } |
AhmedPlaymaker | 16:7b474f873683 | 156 | else if(length == 10) { |
AhmedPlaymaker | 8:890b986b16a4 | 157 | lcd.drawSprite(_x,_y,3,3,(int *)snake_sprite); //Function used to draw the sprite. |
AhmedPlaymaker | 13:9785f2404045 | 158 | lcd.drawSprite(_xa,_ya,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 13:9785f2404045 | 159 | lcd.drawSprite(_xb,_yb,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 13:9785f2404045 | 160 | lcd.drawSprite(_xc,_yc,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 13:9785f2404045 | 161 | lcd.drawSprite(_xd,_yd,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 13:9785f2404045 | 162 | lcd.drawSprite(_xe,_ye,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 13:9785f2404045 | 163 | lcd.drawSprite(_xf,_yf,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 13:9785f2404045 | 164 | lcd.drawSprite(_xg,_yg,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 13:9785f2404045 | 165 | lcd.drawSprite(_xh,_yh,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 13:9785f2404045 | 166 | lcd.drawSprite(_xi,_yi,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 8:890b986b16a4 | 167 | } |
AhmedPlaymaker | 16:7b474f873683 | 168 | else if(length == 11) { |
AhmedPlaymaker | 8:890b986b16a4 | 169 | lcd.drawSprite(_x,_y,3,3,(int *)snake_sprite); //Function used to draw the sprite. |
AhmedPlaymaker | 13:9785f2404045 | 170 | lcd.drawSprite(_xa,_ya,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 13:9785f2404045 | 171 | lcd.drawSprite(_xb,_yb,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 13:9785f2404045 | 172 | lcd.drawSprite(_xc,_yc,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 13:9785f2404045 | 173 | lcd.drawSprite(_xd,_yd,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 13:9785f2404045 | 174 | lcd.drawSprite(_xe,_ye,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 13:9785f2404045 | 175 | lcd.drawSprite(_xf,_yf,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 13:9785f2404045 | 176 | lcd.drawSprite(_xg,_yg,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 13:9785f2404045 | 177 | lcd.drawSprite(_xh,_yh,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 13:9785f2404045 | 178 | lcd.drawSprite(_xi,_yi,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 13:9785f2404045 | 179 | lcd.drawSprite(_xj,_yj,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 8:890b986b16a4 | 180 | } |
AhmedPlaymaker | 16:7b474f873683 | 181 | else if(length == 12) { |
AhmedPlaymaker | 8:890b986b16a4 | 182 | lcd.drawSprite(_x,_y,3,3,(int *)snake_sprite); //Function used to draw the sprite. |
AhmedPlaymaker | 13:9785f2404045 | 183 | lcd.drawSprite(_xa,_ya,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 13:9785f2404045 | 184 | lcd.drawSprite(_xb,_yb,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 13:9785f2404045 | 185 | lcd.drawSprite(_xc,_yc,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 13:9785f2404045 | 186 | lcd.drawSprite(_xd,_yd,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 13:9785f2404045 | 187 | lcd.drawSprite(_xe,_ye,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 13:9785f2404045 | 188 | lcd.drawSprite(_xf,_yf,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 13:9785f2404045 | 189 | lcd.drawSprite(_xg,_yg,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 13:9785f2404045 | 190 | lcd.drawSprite(_xh,_yh,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 13:9785f2404045 | 191 | lcd.drawSprite(_xi,_yi,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 13:9785f2404045 | 192 | lcd.drawSprite(_xj,_yj,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 13:9785f2404045 | 193 | lcd.drawSprite(_xk,_yk,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 8:890b986b16a4 | 194 | } |
AhmedPlaymaker | 16:7b474f873683 | 195 | else if(length == 13) { |
AhmedPlaymaker | 8:890b986b16a4 | 196 | lcd.drawSprite(_x,_y,3,3,(int *)snake_sprite); //Function used to draw the sprite. |
AhmedPlaymaker | 13:9785f2404045 | 197 | lcd.drawSprite(_xa,_ya,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 13:9785f2404045 | 198 | lcd.drawSprite(_xb,_yb,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 13:9785f2404045 | 199 | lcd.drawSprite(_xc,_yc,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 13:9785f2404045 | 200 | lcd.drawSprite(_xd,_yd,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 13:9785f2404045 | 201 | lcd.drawSprite(_xe,_ye,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 13:9785f2404045 | 202 | lcd.drawSprite(_xf,_yf,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 13:9785f2404045 | 203 | lcd.drawSprite(_xg,_yg,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 13:9785f2404045 | 204 | lcd.drawSprite(_xh,_yh,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 13:9785f2404045 | 205 | lcd.drawSprite(_xi,_yi,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 13:9785f2404045 | 206 | lcd.drawSprite(_xj,_yj,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 13:9785f2404045 | 207 | lcd.drawSprite(_xk,_yk,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 13:9785f2404045 | 208 | lcd.drawSprite(_xl,_yl,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 8:890b986b16a4 | 209 | } |
AhmedPlaymaker | 16:7b474f873683 | 210 | else if(length == 14) { |
AhmedPlaymaker | 8:890b986b16a4 | 211 | lcd.drawSprite(_x,_y,3,3,(int *)snake_sprite); //Function used to draw the sprite. |
AhmedPlaymaker | 13:9785f2404045 | 212 | lcd.drawSprite(_xa,_ya,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 13:9785f2404045 | 213 | lcd.drawSprite(_xb,_yb,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 13:9785f2404045 | 214 | lcd.drawSprite(_xc,_yc,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 13:9785f2404045 | 215 | lcd.drawSprite(_xd,_yd,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 13:9785f2404045 | 216 | lcd.drawSprite(_xe,_ye,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 13:9785f2404045 | 217 | lcd.drawSprite(_xf,_yf,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 13:9785f2404045 | 218 | lcd.drawSprite(_xg,_yg,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 13:9785f2404045 | 219 | lcd.drawSprite(_xh,_yh,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 13:9785f2404045 | 220 | lcd.drawSprite(_xi,_yi,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 13:9785f2404045 | 221 | lcd.drawSprite(_xj,_yj,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 13:9785f2404045 | 222 | lcd.drawSprite(_xk,_yk,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 13:9785f2404045 | 223 | lcd.drawSprite(_xl,_yl,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 13:9785f2404045 | 224 | lcd.drawSprite(_xm,_ym,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 8:890b986b16a4 | 225 | } |
AhmedPlaymaker | 16:7b474f873683 | 226 | else if(length == 15) { |
AhmedPlaymaker | 8:890b986b16a4 | 227 | lcd.drawSprite(_x,_y,3,3,(int *)snake_sprite); //Function used to draw the sprite. |
AhmedPlaymaker | 13:9785f2404045 | 228 | lcd.drawSprite(_xa,_ya,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 13:9785f2404045 | 229 | lcd.drawSprite(_xb,_yb,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 13:9785f2404045 | 230 | lcd.drawSprite(_xc,_yc,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 13:9785f2404045 | 231 | lcd.drawSprite(_xd,_yd,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 13:9785f2404045 | 232 | lcd.drawSprite(_xe,_ye,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 13:9785f2404045 | 233 | lcd.drawSprite(_xf,_yf,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 13:9785f2404045 | 234 | lcd.drawSprite(_xg,_yg,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 13:9785f2404045 | 235 | lcd.drawSprite(_xh,_yh,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 13:9785f2404045 | 236 | lcd.drawSprite(_xi,_yi,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 13:9785f2404045 | 237 | lcd.drawSprite(_xj,_yj,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 13:9785f2404045 | 238 | lcd.drawSprite(_xk,_yk,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 13:9785f2404045 | 239 | lcd.drawSprite(_xl,_yl,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 13:9785f2404045 | 240 | lcd.drawSprite(_xm,_ym,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 13:9785f2404045 | 241 | lcd.drawSprite(_xn,_yn,3,3,(int *)snake_sprite); |
AhmedPlaymaker | 8:890b986b16a4 | 242 | } |
AhmedPlaymaker | 17:54e13faeaf64 | 243 | else if(length > 15) { |
AhmedPlaymaker | 17:54e13faeaf64 | 244 | lcd.clear(); |
AhmedPlaymaker | 17:54e13faeaf64 | 245 | lcd.printString("Level Complete",0,1); |
AhmedPlaymaker | 17:54e13faeaf64 | 246 | lcd.refresh(); |
AhmedPlaymaker | 17:54e13faeaf64 | 247 | wait(1); |
AhmedPlaymaker | 17:54e13faeaf64 | 248 | length = 3; |
AhmedPlaymaker | 17:54e13faeaf64 | 249 | } |
AhmedPlaymaker | 17:54e13faeaf64 | 250 | return length; |
AhmedPlaymaker | 7:48ba87cd79b5 | 251 | } |
AhmedPlaymaker | 18:b391caa5754c | 252 | /* |
AhmedPlaymaker | 18:b391caa5754c | 253 | //helps to set the position automatically when we want to restrict it's movement when coliding with lines. |
AhmedPlaymaker | 18:b391caa5754c | 254 | void Snake::set_pos(Vector2D s) |
AhmedPlaymaker | 18:b391caa5754c | 255 | { |
AhmedPlaymaker | 18:b391caa5754c | 256 | if(length == 1) { |
AhmedPlaymaker | 18:b391caa5754c | 257 | _fx = s.x; |
AhmedPlaymaker | 18:b391caa5754c | 258 | _fy = s.y; |
AhmedPlaymaker | 18:b391caa5754c | 259 | } |
AhmedPlaymaker | 18:b391caa5754c | 260 | else if(length == 2) { |
AhmedPlaymaker | 18:b391caa5754c | 261 | _xa = s.x; |
AhmedPlaymaker | 18:b391caa5754c | 262 | _ya = s.y; |
AhmedPlaymaker | 18:b391caa5754c | 263 | } |
AhmedPlaymaker | 18:b391caa5754c | 264 | else if(length==3) { |
AhmedPlaymaker | 18:b391caa5754c | 265 | _xb = s.x; |
AhmedPlaymaker | 18:b391caa5754c | 266 | _yb = s.y; |
AhmedPlaymaker | 18:b391caa5754c | 267 | } |
AhmedPlaymaker | 18:b391caa5754c | 268 | else if(length==4) { |
AhmedPlaymaker | 18:b391caa5754c | 269 | _xc = s.x; |
AhmedPlaymaker | 18:b391caa5754c | 270 | _yc = s.y; |
AhmedPlaymaker | 18:b391caa5754c | 271 | } |
AhmedPlaymaker | 18:b391caa5754c | 272 | else if(length==5) { |
AhmedPlaymaker | 18:b391caa5754c | 273 | _xd = s.x; |
AhmedPlaymaker | 18:b391caa5754c | 274 | _yd = s.y; |
AhmedPlaymaker | 18:b391caa5754c | 275 | } |
AhmedPlaymaker | 18:b391caa5754c | 276 | else if(length==6) { |
AhmedPlaymaker | 18:b391caa5754c | 277 | _xe = s.x; |
AhmedPlaymaker | 18:b391caa5754c | 278 | _ye = s.y; |
AhmedPlaymaker | 18:b391caa5754c | 279 | } |
AhmedPlaymaker | 18:b391caa5754c | 280 | else if(length==7) { |
AhmedPlaymaker | 18:b391caa5754c | 281 | _xf = s.x; |
AhmedPlaymaker | 18:b391caa5754c | 282 | _yf = s.y; |
AhmedPlaymaker | 18:b391caa5754c | 283 | } |
AhmedPlaymaker | 18:b391caa5754c | 284 | else if(length==8) { |
AhmedPlaymaker | 18:b391caa5754c | 285 | _xg = s.x; |
AhmedPlaymaker | 18:b391caa5754c | 286 | _yg = s.y; |
AhmedPlaymaker | 18:b391caa5754c | 287 | } |
AhmedPlaymaker | 18:b391caa5754c | 288 | else if(length==9) { |
AhmedPlaymaker | 18:b391caa5754c | 289 | _xh = s.x; |
AhmedPlaymaker | 18:b391caa5754c | 290 | _yh = s.y; |
AhmedPlaymaker | 18:b391caa5754c | 291 | } |
AhmedPlaymaker | 18:b391caa5754c | 292 | else if(length==10) { |
AhmedPlaymaker | 18:b391caa5754c | 293 | _xi = s.x; |
AhmedPlaymaker | 18:b391caa5754c | 294 | _yi = s.y; |
AhmedPlaymaker | 18:b391caa5754c | 295 | } |
AhmedPlaymaker | 18:b391caa5754c | 296 | else if(length==11) { |
AhmedPlaymaker | 18:b391caa5754c | 297 | _xj = s.x; |
AhmedPlaymaker | 18:b391caa5754c | 298 | _yj = s.y; |
AhmedPlaymaker | 18:b391caa5754c | 299 | } |
AhmedPlaymaker | 18:b391caa5754c | 300 | else if(length==12) { |
AhmedPlaymaker | 18:b391caa5754c | 301 | _xk = s.x; |
AhmedPlaymaker | 18:b391caa5754c | 302 | _yk = s.y; |
AhmedPlaymaker | 18:b391caa5754c | 303 | } |
AhmedPlaymaker | 18:b391caa5754c | 304 | else if(length==13) { |
AhmedPlaymaker | 18:b391caa5754c | 305 | _xl = s.x; |
AhmedPlaymaker | 18:b391caa5754c | 306 | _yl = s.y; |
AhmedPlaymaker | 18:b391caa5754c | 307 | } |
AhmedPlaymaker | 18:b391caa5754c | 308 | else if(length == 14) { |
AhmedPlaymaker | 18:b391caa5754c | 309 | _xm = s.x; |
AhmedPlaymaker | 18:b391caa5754c | 310 | _ym = s.y; |
AhmedPlaymaker | 18:b391caa5754c | 311 | } |
AhmedPlaymaker | 18:b391caa5754c | 312 | else if(length==15) { |
AhmedPlaymaker | 18:b391caa5754c | 313 | _xn = s.x; |
AhmedPlaymaker | 18:b391caa5754c | 314 | _yn = s.y; |
AhmedPlaymaker | 18:b391caa5754c | 315 | } |
AhmedPlaymaker | 18:b391caa5754c | 316 | } |
AhmedPlaymaker | 18:b391caa5754c | 317 | */ |
AhmedPlaymaker | 9:d1d79d4ee673 | 318 | Vector2D Snake::get_pos(int length) |
AhmedPlaymaker | 7:48ba87cd79b5 | 319 | { |
AhmedPlaymaker | 9:d1d79d4ee673 | 320 | if(length == 1) { |
AhmedPlaymaker | 9:d1d79d4ee673 | 321 | Vector2D snakepos = {_x,_y}; //Obtains the snake position. |
AhmedPlaymaker | 9:d1d79d4ee673 | 322 | return snakepos; |
AhmedPlaymaker | 9:d1d79d4ee673 | 323 | } |
AhmedPlaymaker | 9:d1d79d4ee673 | 324 | else if(length == 2) { |
AhmedPlaymaker | 13:9785f2404045 | 325 | Vector2D snakepos = {_xa,_ya}; //Obtains the snake position. |
AhmedPlaymaker | 9:d1d79d4ee673 | 326 | return snakepos; |
AhmedPlaymaker | 9:d1d79d4ee673 | 327 | } |
AhmedPlaymaker | 9:d1d79d4ee673 | 328 | else if(length==3) { |
AhmedPlaymaker | 13:9785f2404045 | 329 | Vector2D snakepos = {_xb,_yb}; //Obtains the snake position. |
AhmedPlaymaker | 9:d1d79d4ee673 | 330 | return snakepos; |
AhmedPlaymaker | 9:d1d79d4ee673 | 331 | } |
AhmedPlaymaker | 9:d1d79d4ee673 | 332 | else if(length==4) { |
AhmedPlaymaker | 13:9785f2404045 | 333 | Vector2D snakepos = {_xc,_yc}; //Obtains the snake position. |
AhmedPlaymaker | 9:d1d79d4ee673 | 334 | return snakepos; |
AhmedPlaymaker | 9:d1d79d4ee673 | 335 | } |
AhmedPlaymaker | 9:d1d79d4ee673 | 336 | else if(length==5) { |
AhmedPlaymaker | 13:9785f2404045 | 337 | Vector2D snakepos = {_xd,_yd}; //Obtains the snake position. |
AhmedPlaymaker | 9:d1d79d4ee673 | 338 | return snakepos; |
AhmedPlaymaker | 9:d1d79d4ee673 | 339 | } |
AhmedPlaymaker | 9:d1d79d4ee673 | 340 | else if(length==6) { |
AhmedPlaymaker | 13:9785f2404045 | 341 | Vector2D snakepos = {_xe,_ye}; //Obtains the snake position. |
AhmedPlaymaker | 9:d1d79d4ee673 | 342 | return snakepos; |
AhmedPlaymaker | 9:d1d79d4ee673 | 343 | } |
AhmedPlaymaker | 9:d1d79d4ee673 | 344 | else if(length==7) { |
AhmedPlaymaker | 13:9785f2404045 | 345 | Vector2D snakepos = {_xf,_yf}; //Obtains the snake position. |
AhmedPlaymaker | 9:d1d79d4ee673 | 346 | return snakepos; |
AhmedPlaymaker | 9:d1d79d4ee673 | 347 | } |
AhmedPlaymaker | 9:d1d79d4ee673 | 348 | else if(length==8) { |
AhmedPlaymaker | 13:9785f2404045 | 349 | Vector2D snakepos = {_xg,_yg}; //Obtains the snake position. |
AhmedPlaymaker | 9:d1d79d4ee673 | 350 | return snakepos; |
AhmedPlaymaker | 9:d1d79d4ee673 | 351 | } |
AhmedPlaymaker | 9:d1d79d4ee673 | 352 | else if(length==9) { |
AhmedPlaymaker | 13:9785f2404045 | 353 | Vector2D snakepos = {_xh,_yh}; //Obtains the snake position. |
AhmedPlaymaker | 9:d1d79d4ee673 | 354 | return snakepos; |
AhmedPlaymaker | 9:d1d79d4ee673 | 355 | } |
AhmedPlaymaker | 9:d1d79d4ee673 | 356 | else if(length==10) { |
AhmedPlaymaker | 13:9785f2404045 | 357 | Vector2D snakepos = {_xi,_yi}; //Obtains the snake position. |
AhmedPlaymaker | 9:d1d79d4ee673 | 358 | return snakepos; |
AhmedPlaymaker | 9:d1d79d4ee673 | 359 | } |
AhmedPlaymaker | 9:d1d79d4ee673 | 360 | else if(length==11) { |
AhmedPlaymaker | 13:9785f2404045 | 361 | Vector2D snakepos = {_xj,_yj}; //Obtains the snake position. |
AhmedPlaymaker | 9:d1d79d4ee673 | 362 | return snakepos; |
AhmedPlaymaker | 9:d1d79d4ee673 | 363 | } |
AhmedPlaymaker | 9:d1d79d4ee673 | 364 | else if(length==12) { |
AhmedPlaymaker | 13:9785f2404045 | 365 | Vector2D snakepos = {_xk,_yk}; //Obtains the snake position. |
AhmedPlaymaker | 9:d1d79d4ee673 | 366 | return snakepos; |
AhmedPlaymaker | 9:d1d79d4ee673 | 367 | } |
AhmedPlaymaker | 9:d1d79d4ee673 | 368 | else if(length==13) { |
AhmedPlaymaker | 13:9785f2404045 | 369 | Vector2D snakepos = {_xl,_yl}; //Obtains the snake position. |
AhmedPlaymaker | 9:d1d79d4ee673 | 370 | return snakepos; |
AhmedPlaymaker | 9:d1d79d4ee673 | 371 | } |
AhmedPlaymaker | 9:d1d79d4ee673 | 372 | else if(length == 14) { |
AhmedPlaymaker | 13:9785f2404045 | 373 | Vector2D snakepos = {_xm,_ym}; //Obtains the snake position. |
AhmedPlaymaker | 9:d1d79d4ee673 | 374 | return snakepos; |
AhmedPlaymaker | 9:d1d79d4ee673 | 375 | } |
AhmedPlaymaker | 9:d1d79d4ee673 | 376 | else if(length==15) { |
AhmedPlaymaker | 13:9785f2404045 | 377 | Vector2D snakepos = {_xn,_yn}; //Obtains the snake position. |
AhmedPlaymaker | 9:d1d79d4ee673 | 378 | return snakepos; |
AhmedPlaymaker | 9:d1d79d4ee673 | 379 | } |
AhmedPlaymaker | 7:48ba87cd79b5 | 380 | //printf("snakepos from player = %f %f \n", snakepos.x, snakepos.y); |
AhmedPlaymaker | 13:9785f2404045 | 381 | else { |
AhmedPlaymaker | 13:9785f2404045 | 382 | Vector2D snakepos = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 383 | return snakepos; |
AhmedPlaymaker | 13:9785f2404045 | 384 | } |
AhmedPlaymaker | 13:9785f2404045 | 385 | } |
AhmedPlaymaker | 13:9785f2404045 | 386 | |
AhmedPlaymaker | 13:9785f2404045 | 387 | Vector2D Snake::get_pos_before1(int length) //this sends data of following sprites. |
AhmedPlaymaker | 13:9785f2404045 | 388 | { |
AhmedPlaymaker | 13:9785f2404045 | 389 | if(length == 1) { |
AhmedPlaymaker | 13:9785f2404045 | 390 | Vector2D snakepos_b1 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 391 | return snakepos_b1; |
AhmedPlaymaker | 13:9785f2404045 | 392 | } |
AhmedPlaymaker | 13:9785f2404045 | 393 | else if(length == 2) { |
AhmedPlaymaker | 13:9785f2404045 | 394 | Vector2D snakepos_b1 = {_x,_y}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 395 | return snakepos_b1; |
AhmedPlaymaker | 13:9785f2404045 | 396 | } |
AhmedPlaymaker | 13:9785f2404045 | 397 | else if(length==3) { |
AhmedPlaymaker | 13:9785f2404045 | 398 | Vector2D snakepos_b1 = {_xa,_ya}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 399 | return snakepos_b1; |
AhmedPlaymaker | 13:9785f2404045 | 400 | } |
AhmedPlaymaker | 13:9785f2404045 | 401 | else if(length==4) { |
AhmedPlaymaker | 13:9785f2404045 | 402 | Vector2D snakepos_b1 = {_xb,_yb}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 403 | return snakepos_b1; |
AhmedPlaymaker | 13:9785f2404045 | 404 | } |
AhmedPlaymaker | 13:9785f2404045 | 405 | else if(length==5) { |
AhmedPlaymaker | 13:9785f2404045 | 406 | Vector2D snakepos_b1 = {_xc,_yc}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 407 | return snakepos_b1; |
AhmedPlaymaker | 13:9785f2404045 | 408 | } |
AhmedPlaymaker | 13:9785f2404045 | 409 | else if(length==6) { |
AhmedPlaymaker | 13:9785f2404045 | 410 | Vector2D snakepos_b1 = {_xd,_yd}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 411 | return snakepos_b1; |
AhmedPlaymaker | 13:9785f2404045 | 412 | } |
AhmedPlaymaker | 13:9785f2404045 | 413 | else if(length==7) { |
AhmedPlaymaker | 13:9785f2404045 | 414 | Vector2D snakepos_b1 = {_xe,_ye}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 415 | return snakepos_b1; |
AhmedPlaymaker | 13:9785f2404045 | 416 | } |
AhmedPlaymaker | 13:9785f2404045 | 417 | else if(length==8) { |
AhmedPlaymaker | 13:9785f2404045 | 418 | Vector2D snakepos_b1 = {_xf,_yf}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 419 | return snakepos_b1; |
AhmedPlaymaker | 13:9785f2404045 | 420 | } |
AhmedPlaymaker | 13:9785f2404045 | 421 | else if(length==9) { |
AhmedPlaymaker | 13:9785f2404045 | 422 | Vector2D snakepos_b1 = {_xg,_yg}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 423 | return snakepos_b1; |
AhmedPlaymaker | 13:9785f2404045 | 424 | } |
AhmedPlaymaker | 13:9785f2404045 | 425 | else if(length==10) { |
AhmedPlaymaker | 13:9785f2404045 | 426 | Vector2D snakepos_b1 = {_xh,_yh}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 427 | return snakepos_b1; |
AhmedPlaymaker | 13:9785f2404045 | 428 | } |
AhmedPlaymaker | 13:9785f2404045 | 429 | else if(length==11) { |
AhmedPlaymaker | 13:9785f2404045 | 430 | Vector2D snakepos_b1 = {_xi,_yi}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 431 | return snakepos_b1; |
AhmedPlaymaker | 13:9785f2404045 | 432 | } |
AhmedPlaymaker | 13:9785f2404045 | 433 | else if(length==12) { |
AhmedPlaymaker | 13:9785f2404045 | 434 | Vector2D snakepos_b1 = {_xj,_yj}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 435 | return snakepos_b1; |
AhmedPlaymaker | 13:9785f2404045 | 436 | } |
AhmedPlaymaker | 13:9785f2404045 | 437 | else if(length==13) { |
AhmedPlaymaker | 13:9785f2404045 | 438 | Vector2D snakepos_b1 = {_xk,_yk}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 439 | return snakepos_b1; |
AhmedPlaymaker | 13:9785f2404045 | 440 | } |
AhmedPlaymaker | 13:9785f2404045 | 441 | else if(length == 14) { |
AhmedPlaymaker | 13:9785f2404045 | 442 | Vector2D snakepos_b1 = {_xl,_yl}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 443 | return snakepos_b1; |
AhmedPlaymaker | 13:9785f2404045 | 444 | } |
AhmedPlaymaker | 13:9785f2404045 | 445 | else if(length==15) { |
AhmedPlaymaker | 13:9785f2404045 | 446 | Vector2D snakepos_b1 = {_xm,_ym}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 447 | return snakepos_b1; |
AhmedPlaymaker | 13:9785f2404045 | 448 | } |
AhmedPlaymaker | 13:9785f2404045 | 449 | //printf("snakepos from player = %f %f \n", snakepos.x, snakepos.y); |
AhmedPlaymaker | 13:9785f2404045 | 450 | else { |
AhmedPlaymaker | 13:9785f2404045 | 451 | Vector2D snakepos_b1 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 452 | return snakepos_b1; |
AhmedPlaymaker | 13:9785f2404045 | 453 | } |
AhmedPlaymaker | 13:9785f2404045 | 454 | } |
AhmedPlaymaker | 13:9785f2404045 | 455 | |
AhmedPlaymaker | 13:9785f2404045 | 456 | Vector2D Snake::get_pos_before2(int length) //this sends data of following sprites. |
AhmedPlaymaker | 13:9785f2404045 | 457 | { |
AhmedPlaymaker | 13:9785f2404045 | 458 | if(length == 1) { |
AhmedPlaymaker | 13:9785f2404045 | 459 | Vector2D snakepos_b2 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 460 | return snakepos_b2; |
AhmedPlaymaker | 13:9785f2404045 | 461 | } |
AhmedPlaymaker | 13:9785f2404045 | 462 | else if(length == 2) { |
AhmedPlaymaker | 13:9785f2404045 | 463 | Vector2D snakepos_b2 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 464 | return snakepos_b2; |
AhmedPlaymaker | 13:9785f2404045 | 465 | } |
AhmedPlaymaker | 13:9785f2404045 | 466 | else if(length == 3) { |
AhmedPlaymaker | 13:9785f2404045 | 467 | Vector2D snakepos_b2 = {_x,_y}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 468 | return snakepos_b2; |
AhmedPlaymaker | 13:9785f2404045 | 469 | } |
AhmedPlaymaker | 13:9785f2404045 | 470 | else if(length==4) { |
AhmedPlaymaker | 13:9785f2404045 | 471 | Vector2D snakepos_b2 = {_xa,_ya}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 472 | return snakepos_b2; |
AhmedPlaymaker | 13:9785f2404045 | 473 | } |
AhmedPlaymaker | 13:9785f2404045 | 474 | else if(length==5) { |
AhmedPlaymaker | 13:9785f2404045 | 475 | Vector2D snakepos_b2 = {_xb,_yb}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 476 | return snakepos_b2; |
AhmedPlaymaker | 13:9785f2404045 | 477 | } |
AhmedPlaymaker | 13:9785f2404045 | 478 | else if(length==6) { |
AhmedPlaymaker | 13:9785f2404045 | 479 | Vector2D snakepos_b2 = {_xc,_yc}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 480 | return snakepos_b2; |
AhmedPlaymaker | 13:9785f2404045 | 481 | } |
AhmedPlaymaker | 13:9785f2404045 | 482 | else if(length==7) { |
AhmedPlaymaker | 13:9785f2404045 | 483 | Vector2D snakepos_b2 = {_xd,_yd}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 484 | return snakepos_b2; |
AhmedPlaymaker | 13:9785f2404045 | 485 | } |
AhmedPlaymaker | 13:9785f2404045 | 486 | else if(length==8) { |
AhmedPlaymaker | 13:9785f2404045 | 487 | Vector2D snakepos_b2 = {_xe,_ye}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 488 | return snakepos_b2; |
AhmedPlaymaker | 13:9785f2404045 | 489 | } |
AhmedPlaymaker | 13:9785f2404045 | 490 | else if(length==9) { |
AhmedPlaymaker | 13:9785f2404045 | 491 | Vector2D snakepos_b2 = {_xf,_yf}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 492 | return snakepos_b2; |
AhmedPlaymaker | 13:9785f2404045 | 493 | } |
AhmedPlaymaker | 13:9785f2404045 | 494 | else if(length==10) { |
AhmedPlaymaker | 13:9785f2404045 | 495 | Vector2D snakepos_b2 = {_xg,_yg}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 496 | return snakepos_b2; |
AhmedPlaymaker | 13:9785f2404045 | 497 | } |
AhmedPlaymaker | 13:9785f2404045 | 498 | else if(length==11) { |
AhmedPlaymaker | 13:9785f2404045 | 499 | Vector2D snakepos_b2 = {_xh,_yh}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 500 | return snakepos_b2; |
AhmedPlaymaker | 13:9785f2404045 | 501 | } |
AhmedPlaymaker | 13:9785f2404045 | 502 | else if(length==12) { |
AhmedPlaymaker | 13:9785f2404045 | 503 | Vector2D snakepos_b2 = {_xi,_yi}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 504 | return snakepos_b2; |
AhmedPlaymaker | 13:9785f2404045 | 505 | } |
AhmedPlaymaker | 13:9785f2404045 | 506 | else if(length==13) { |
AhmedPlaymaker | 13:9785f2404045 | 507 | Vector2D snakepos_b2 = {_xj,_yj}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 508 | return snakepos_b2; |
AhmedPlaymaker | 13:9785f2404045 | 509 | } |
AhmedPlaymaker | 13:9785f2404045 | 510 | else if(length==14) { |
AhmedPlaymaker | 13:9785f2404045 | 511 | Vector2D snakepos_b2 = {_xk,_yk}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 512 | return snakepos_b2; |
AhmedPlaymaker | 13:9785f2404045 | 513 | } |
AhmedPlaymaker | 13:9785f2404045 | 514 | else if(length == 15) { |
AhmedPlaymaker | 13:9785f2404045 | 515 | Vector2D snakepos_b2 = {_xl,_yl}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 516 | return snakepos_b2; |
AhmedPlaymaker | 13:9785f2404045 | 517 | } |
AhmedPlaymaker | 13:9785f2404045 | 518 | //printf("snakepos from player = %f %f \n", snakepos.x, snakepos.y); |
AhmedPlaymaker | 13:9785f2404045 | 519 | else { |
AhmedPlaymaker | 13:9785f2404045 | 520 | Vector2D snakepos_b2 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 521 | return snakepos_b2; |
AhmedPlaymaker | 13:9785f2404045 | 522 | } |
AhmedPlaymaker | 13:9785f2404045 | 523 | } |
AhmedPlaymaker | 13:9785f2404045 | 524 | |
AhmedPlaymaker | 13:9785f2404045 | 525 | Vector2D Snake::get_pos_before3(int length) //this sends data of following sprites. |
AhmedPlaymaker | 13:9785f2404045 | 526 | { |
AhmedPlaymaker | 13:9785f2404045 | 527 | if(length == 1) { |
AhmedPlaymaker | 13:9785f2404045 | 528 | Vector2D snakepos_b3 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 529 | return snakepos_b3; |
AhmedPlaymaker | 13:9785f2404045 | 530 | } |
AhmedPlaymaker | 13:9785f2404045 | 531 | else if(length == 2) { |
AhmedPlaymaker | 13:9785f2404045 | 532 | Vector2D snakepos_b3 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 533 | return snakepos_b3; |
AhmedPlaymaker | 13:9785f2404045 | 534 | } |
AhmedPlaymaker | 13:9785f2404045 | 535 | else if(length == 3) { |
AhmedPlaymaker | 13:9785f2404045 | 536 | Vector2D snakepos_b3 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 537 | return snakepos_b3; |
AhmedPlaymaker | 13:9785f2404045 | 538 | } |
AhmedPlaymaker | 13:9785f2404045 | 539 | else if(length == 4) { |
AhmedPlaymaker | 13:9785f2404045 | 540 | Vector2D snakepos_b3 = {_x,_y}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 541 | return snakepos_b3; |
AhmedPlaymaker | 13:9785f2404045 | 542 | } |
AhmedPlaymaker | 13:9785f2404045 | 543 | else if(length==5) { |
AhmedPlaymaker | 13:9785f2404045 | 544 | Vector2D snakepos_b3 = {_xa,_ya}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 545 | return snakepos_b3; |
AhmedPlaymaker | 13:9785f2404045 | 546 | } |
AhmedPlaymaker | 13:9785f2404045 | 547 | else if(length==6) { |
AhmedPlaymaker | 13:9785f2404045 | 548 | Vector2D snakepos_b3 = {_xb,_yb}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 549 | return snakepos_b3; |
AhmedPlaymaker | 13:9785f2404045 | 550 | } |
AhmedPlaymaker | 13:9785f2404045 | 551 | else if(length==7) { |
AhmedPlaymaker | 13:9785f2404045 | 552 | Vector2D snakepos_b3 = {_xc,_yc}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 553 | return snakepos_b3; |
AhmedPlaymaker | 13:9785f2404045 | 554 | } |
AhmedPlaymaker | 13:9785f2404045 | 555 | else if(length==8) { |
AhmedPlaymaker | 13:9785f2404045 | 556 | Vector2D snakepos_b3 = {_xd,_yd}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 557 | return snakepos_b3; |
AhmedPlaymaker | 13:9785f2404045 | 558 | } |
AhmedPlaymaker | 13:9785f2404045 | 559 | else if(length==9) { |
AhmedPlaymaker | 13:9785f2404045 | 560 | Vector2D snakepos_b3 = {_xe,_ye}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 561 | return snakepos_b3; |
AhmedPlaymaker | 13:9785f2404045 | 562 | } |
AhmedPlaymaker | 13:9785f2404045 | 563 | else if(length==10) { |
AhmedPlaymaker | 13:9785f2404045 | 564 | Vector2D snakepos_b3 = {_xf,_yf}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 565 | return snakepos_b3; |
AhmedPlaymaker | 13:9785f2404045 | 566 | } |
AhmedPlaymaker | 13:9785f2404045 | 567 | else if(length==11) { |
AhmedPlaymaker | 13:9785f2404045 | 568 | Vector2D snakepos_b3 = {_xg,_yg}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 569 | return snakepos_b3; |
AhmedPlaymaker | 13:9785f2404045 | 570 | } |
AhmedPlaymaker | 13:9785f2404045 | 571 | else if(length==12) { |
AhmedPlaymaker | 13:9785f2404045 | 572 | Vector2D snakepos_b3 = {_xh,_yh}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 573 | return snakepos_b3; |
AhmedPlaymaker | 13:9785f2404045 | 574 | } |
AhmedPlaymaker | 13:9785f2404045 | 575 | else if(length==13) { |
AhmedPlaymaker | 13:9785f2404045 | 576 | Vector2D snakepos_b3 = {_xi,_yi}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 577 | return snakepos_b3; |
AhmedPlaymaker | 13:9785f2404045 | 578 | } |
AhmedPlaymaker | 13:9785f2404045 | 579 | else if(length==14) { |
AhmedPlaymaker | 13:9785f2404045 | 580 | Vector2D snakepos_b3 = {_xj,_yj}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 581 | return snakepos_b3; |
AhmedPlaymaker | 13:9785f2404045 | 582 | } |
AhmedPlaymaker | 13:9785f2404045 | 583 | else if(length==15) { |
AhmedPlaymaker | 13:9785f2404045 | 584 | Vector2D snakepos_b3 = {_xk,_yk}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 585 | return snakepos_b3; |
AhmedPlaymaker | 13:9785f2404045 | 586 | } |
AhmedPlaymaker | 13:9785f2404045 | 587 | //printf("snakepos from player = %f %f \n", snakepos.x, snakepos.y); |
AhmedPlaymaker | 13:9785f2404045 | 588 | else { |
AhmedPlaymaker | 13:9785f2404045 | 589 | Vector2D snakepos_b3 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 590 | return snakepos_b3; |
AhmedPlaymaker | 13:9785f2404045 | 591 | } |
AhmedPlaymaker | 13:9785f2404045 | 592 | } |
AhmedPlaymaker | 13:9785f2404045 | 593 | |
AhmedPlaymaker | 13:9785f2404045 | 594 | Vector2D Snake::get_pos_before4(int length) //this sends data of following sprites. |
AhmedPlaymaker | 13:9785f2404045 | 595 | { |
AhmedPlaymaker | 13:9785f2404045 | 596 | if(length == 1) { |
AhmedPlaymaker | 13:9785f2404045 | 597 | Vector2D snakepos_b4 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 598 | return snakepos_b4; |
AhmedPlaymaker | 13:9785f2404045 | 599 | } |
AhmedPlaymaker | 13:9785f2404045 | 600 | else if(length == 2) { |
AhmedPlaymaker | 13:9785f2404045 | 601 | Vector2D snakepos_b4 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 602 | return snakepos_b4; |
AhmedPlaymaker | 13:9785f2404045 | 603 | } |
AhmedPlaymaker | 13:9785f2404045 | 604 | else if(length == 3) { |
AhmedPlaymaker | 13:9785f2404045 | 605 | Vector2D snakepos_b4 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 606 | return snakepos_b4; |
AhmedPlaymaker | 13:9785f2404045 | 607 | } |
AhmedPlaymaker | 13:9785f2404045 | 608 | else if(length == 4) { |
AhmedPlaymaker | 13:9785f2404045 | 609 | Vector2D snakepos_b4 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 610 | return snakepos_b4; |
AhmedPlaymaker | 13:9785f2404045 | 611 | } |
AhmedPlaymaker | 13:9785f2404045 | 612 | else if(length == 5) { |
AhmedPlaymaker | 13:9785f2404045 | 613 | Vector2D snakepos_b4 = {_x,_y}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 614 | return snakepos_b4; |
AhmedPlaymaker | 13:9785f2404045 | 615 | } |
AhmedPlaymaker | 13:9785f2404045 | 616 | else if(length==6) { |
AhmedPlaymaker | 13:9785f2404045 | 617 | Vector2D snakepos_b4 = {_xa,_ya}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 618 | return snakepos_b4; |
AhmedPlaymaker | 13:9785f2404045 | 619 | } |
AhmedPlaymaker | 13:9785f2404045 | 620 | else if(length==7) { |
AhmedPlaymaker | 13:9785f2404045 | 621 | Vector2D snakepos_b4 = {_xb,_yb}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 622 | return snakepos_b4; |
AhmedPlaymaker | 13:9785f2404045 | 623 | } |
AhmedPlaymaker | 13:9785f2404045 | 624 | else if(length==8) { |
AhmedPlaymaker | 13:9785f2404045 | 625 | Vector2D snakepos_b4 = {_xc,_yc}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 626 | return snakepos_b4; |
AhmedPlaymaker | 13:9785f2404045 | 627 | } |
AhmedPlaymaker | 13:9785f2404045 | 628 | else if(length==9) { |
AhmedPlaymaker | 13:9785f2404045 | 629 | Vector2D snakepos_b4 = {_xd,_yd}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 630 | return snakepos_b4; |
AhmedPlaymaker | 13:9785f2404045 | 631 | } |
AhmedPlaymaker | 13:9785f2404045 | 632 | else if(length==10) { |
AhmedPlaymaker | 13:9785f2404045 | 633 | Vector2D snakepos_b4 = {_xe,_ye}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 634 | return snakepos_b4; |
AhmedPlaymaker | 13:9785f2404045 | 635 | } |
AhmedPlaymaker | 13:9785f2404045 | 636 | else if(length==11) { |
AhmedPlaymaker | 13:9785f2404045 | 637 | Vector2D snakepos_b4 = {_xf,_yf}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 638 | return snakepos_b4; |
AhmedPlaymaker | 13:9785f2404045 | 639 | } |
AhmedPlaymaker | 13:9785f2404045 | 640 | else if(length==12) { |
AhmedPlaymaker | 13:9785f2404045 | 641 | Vector2D snakepos_b4 = {_xg,_yg}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 642 | return snakepos_b4; |
AhmedPlaymaker | 13:9785f2404045 | 643 | } |
AhmedPlaymaker | 13:9785f2404045 | 644 | else if(length==13) { |
AhmedPlaymaker | 13:9785f2404045 | 645 | Vector2D snakepos_b4 = {_xh,_yh}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 646 | return snakepos_b4; |
AhmedPlaymaker | 13:9785f2404045 | 647 | } |
AhmedPlaymaker | 13:9785f2404045 | 648 | else if(length==14) { |
AhmedPlaymaker | 13:9785f2404045 | 649 | Vector2D snakepos_b4 = {_xi,_yi}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 650 | return snakepos_b4; |
AhmedPlaymaker | 13:9785f2404045 | 651 | } |
AhmedPlaymaker | 13:9785f2404045 | 652 | else if(length==15) { |
AhmedPlaymaker | 13:9785f2404045 | 653 | Vector2D snakepos_b4 = {_xj,_yj}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 654 | return snakepos_b4; |
AhmedPlaymaker | 13:9785f2404045 | 655 | } |
AhmedPlaymaker | 13:9785f2404045 | 656 | //printf("snakepos from player = %f %f \n", snakepos.x, snakepos.y); |
AhmedPlaymaker | 13:9785f2404045 | 657 | else { |
AhmedPlaymaker | 13:9785f2404045 | 658 | Vector2D snakepos_b4 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 659 | return snakepos_b4; |
AhmedPlaymaker | 13:9785f2404045 | 660 | } |
AhmedPlaymaker | 13:9785f2404045 | 661 | } |
AhmedPlaymaker | 13:9785f2404045 | 662 | |
AhmedPlaymaker | 13:9785f2404045 | 663 | Vector2D Snake::get_pos_before5(int length) //this sends data of following sprites. |
AhmedPlaymaker | 13:9785f2404045 | 664 | { |
AhmedPlaymaker | 13:9785f2404045 | 665 | if(length == 1) { |
AhmedPlaymaker | 13:9785f2404045 | 666 | Vector2D snakepos_b5 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 667 | return snakepos_b5; |
AhmedPlaymaker | 13:9785f2404045 | 668 | } |
AhmedPlaymaker | 13:9785f2404045 | 669 | else if(length == 2) { |
AhmedPlaymaker | 13:9785f2404045 | 670 | Vector2D snakepos_b5 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 671 | return snakepos_b5; |
AhmedPlaymaker | 13:9785f2404045 | 672 | } |
AhmedPlaymaker | 13:9785f2404045 | 673 | else if(length == 3) { |
AhmedPlaymaker | 13:9785f2404045 | 674 | Vector2D snakepos_b5 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 675 | return snakepos_b5; |
AhmedPlaymaker | 13:9785f2404045 | 676 | } |
AhmedPlaymaker | 13:9785f2404045 | 677 | else if(length == 4) { |
AhmedPlaymaker | 13:9785f2404045 | 678 | Vector2D snakepos_b5 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 679 | return snakepos_b5; |
AhmedPlaymaker | 13:9785f2404045 | 680 | } |
AhmedPlaymaker | 13:9785f2404045 | 681 | else if(length == 5) { |
AhmedPlaymaker | 13:9785f2404045 | 682 | Vector2D snakepos_b5 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 683 | return snakepos_b5; |
AhmedPlaymaker | 13:9785f2404045 | 684 | } |
AhmedPlaymaker | 13:9785f2404045 | 685 | else if(length == 6) { |
AhmedPlaymaker | 13:9785f2404045 | 686 | Vector2D snakepos_b5 = {_x,_y}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 687 | return snakepos_b5; |
AhmedPlaymaker | 13:9785f2404045 | 688 | } |
AhmedPlaymaker | 13:9785f2404045 | 689 | else if(length==7) { |
AhmedPlaymaker | 13:9785f2404045 | 690 | Vector2D snakepos_b5 = {_xa,_ya}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 691 | return snakepos_b5; |
AhmedPlaymaker | 13:9785f2404045 | 692 | } |
AhmedPlaymaker | 13:9785f2404045 | 693 | else if(length==8) { |
AhmedPlaymaker | 13:9785f2404045 | 694 | Vector2D snakepos_b5 = {_xb,_yb}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 695 | return snakepos_b5; |
AhmedPlaymaker | 13:9785f2404045 | 696 | } |
AhmedPlaymaker | 13:9785f2404045 | 697 | else if(length==9) { |
AhmedPlaymaker | 13:9785f2404045 | 698 | Vector2D snakepos_b5 = {_xc,_yc}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 699 | return snakepos_b5; |
AhmedPlaymaker | 13:9785f2404045 | 700 | } |
AhmedPlaymaker | 13:9785f2404045 | 701 | else if(length==10) { |
AhmedPlaymaker | 13:9785f2404045 | 702 | Vector2D snakepos_b5 = {_xd,_yd}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 703 | return snakepos_b5; |
AhmedPlaymaker | 13:9785f2404045 | 704 | } |
AhmedPlaymaker | 13:9785f2404045 | 705 | else if(length==11) { |
AhmedPlaymaker | 13:9785f2404045 | 706 | Vector2D snakepos_b5 = {_xe,_ye}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 707 | return snakepos_b5; |
AhmedPlaymaker | 13:9785f2404045 | 708 | } |
AhmedPlaymaker | 13:9785f2404045 | 709 | else if(length==12) { |
AhmedPlaymaker | 13:9785f2404045 | 710 | Vector2D snakepos_b5 = {_xf,_yf}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 711 | return snakepos_b5; |
AhmedPlaymaker | 13:9785f2404045 | 712 | } |
AhmedPlaymaker | 13:9785f2404045 | 713 | else if(length==13) { |
AhmedPlaymaker | 13:9785f2404045 | 714 | Vector2D snakepos_b5 = {_xg,_yg}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 715 | return snakepos_b5; |
AhmedPlaymaker | 13:9785f2404045 | 716 | } |
AhmedPlaymaker | 13:9785f2404045 | 717 | else if(length==14) { |
AhmedPlaymaker | 13:9785f2404045 | 718 | Vector2D snakepos_b5 = {_xh,_yh}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 719 | return snakepos_b5; |
AhmedPlaymaker | 13:9785f2404045 | 720 | } |
AhmedPlaymaker | 13:9785f2404045 | 721 | else if(length==15) { |
AhmedPlaymaker | 13:9785f2404045 | 722 | Vector2D snakepos_b5 = {_xi,_yi}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 723 | return snakepos_b5; |
AhmedPlaymaker | 13:9785f2404045 | 724 | } |
AhmedPlaymaker | 13:9785f2404045 | 725 | //printf("snakepos from player = %f %f \n", snakepos.x, snakepos.y); |
AhmedPlaymaker | 13:9785f2404045 | 726 | else { |
AhmedPlaymaker | 13:9785f2404045 | 727 | Vector2D snakepos_b5 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 728 | return snakepos_b5; |
AhmedPlaymaker | 13:9785f2404045 | 729 | } |
AhmedPlaymaker | 13:9785f2404045 | 730 | } |
AhmedPlaymaker | 13:9785f2404045 | 731 | |
AhmedPlaymaker | 13:9785f2404045 | 732 | Vector2D Snake::get_pos_before6(int length) //this sends data of following sprites. |
AhmedPlaymaker | 13:9785f2404045 | 733 | { |
AhmedPlaymaker | 13:9785f2404045 | 734 | if(length == 1) { |
AhmedPlaymaker | 13:9785f2404045 | 735 | Vector2D snakepos_b6 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 736 | return snakepos_b6; |
AhmedPlaymaker | 13:9785f2404045 | 737 | } |
AhmedPlaymaker | 13:9785f2404045 | 738 | else if(length == 2) { |
AhmedPlaymaker | 13:9785f2404045 | 739 | Vector2D snakepos_b6 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 740 | return snakepos_b6; |
AhmedPlaymaker | 13:9785f2404045 | 741 | } |
AhmedPlaymaker | 13:9785f2404045 | 742 | else if(length == 3) { |
AhmedPlaymaker | 13:9785f2404045 | 743 | Vector2D snakepos_b6 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 744 | return snakepos_b6; |
AhmedPlaymaker | 13:9785f2404045 | 745 | } |
AhmedPlaymaker | 13:9785f2404045 | 746 | else if(length == 4) { |
AhmedPlaymaker | 13:9785f2404045 | 747 | Vector2D snakepos_b6 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 748 | return snakepos_b6; |
AhmedPlaymaker | 13:9785f2404045 | 749 | } |
AhmedPlaymaker | 13:9785f2404045 | 750 | else if(length == 5) { |
AhmedPlaymaker | 13:9785f2404045 | 751 | Vector2D snakepos_b6 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 752 | return snakepos_b6; |
AhmedPlaymaker | 13:9785f2404045 | 753 | } |
AhmedPlaymaker | 13:9785f2404045 | 754 | else if(length == 6) { |
AhmedPlaymaker | 13:9785f2404045 | 755 | Vector2D snakepos_b6 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 756 | return snakepos_b6; |
AhmedPlaymaker | 13:9785f2404045 | 757 | } |
AhmedPlaymaker | 13:9785f2404045 | 758 | else if(length == 7) { |
AhmedPlaymaker | 13:9785f2404045 | 759 | Vector2D snakepos_b6 = {_x,_y}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 760 | return snakepos_b6; |
AhmedPlaymaker | 13:9785f2404045 | 761 | } |
AhmedPlaymaker | 13:9785f2404045 | 762 | else if(length==8) { |
AhmedPlaymaker | 13:9785f2404045 | 763 | Vector2D snakepos_b6 = {_xa,_ya}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 764 | return snakepos_b6; |
AhmedPlaymaker | 13:9785f2404045 | 765 | } |
AhmedPlaymaker | 13:9785f2404045 | 766 | else if(length==9) { |
AhmedPlaymaker | 13:9785f2404045 | 767 | Vector2D snakepos_b6 = {_xb,_yb}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 768 | return snakepos_b6; |
AhmedPlaymaker | 13:9785f2404045 | 769 | } |
AhmedPlaymaker | 13:9785f2404045 | 770 | else if(length==10) { |
AhmedPlaymaker | 13:9785f2404045 | 771 | Vector2D snakepos_b6 = {_xc,_yc}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 772 | return snakepos_b6; |
AhmedPlaymaker | 13:9785f2404045 | 773 | } |
AhmedPlaymaker | 13:9785f2404045 | 774 | else if(length==11) { |
AhmedPlaymaker | 13:9785f2404045 | 775 | Vector2D snakepos_b6 = {_xd,_yd}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 776 | return snakepos_b6; |
AhmedPlaymaker | 13:9785f2404045 | 777 | } |
AhmedPlaymaker | 13:9785f2404045 | 778 | else if(length==12) { |
AhmedPlaymaker | 13:9785f2404045 | 779 | Vector2D snakepos_b6 = {_xe,_ye}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 780 | return snakepos_b6; |
AhmedPlaymaker | 13:9785f2404045 | 781 | } |
AhmedPlaymaker | 13:9785f2404045 | 782 | else if(length==13) { |
AhmedPlaymaker | 13:9785f2404045 | 783 | Vector2D snakepos_b6 = {_xf,_yf}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 784 | return snakepos_b6; |
AhmedPlaymaker | 13:9785f2404045 | 785 | } |
AhmedPlaymaker | 13:9785f2404045 | 786 | else if(length==14) { |
AhmedPlaymaker | 13:9785f2404045 | 787 | Vector2D snakepos_b6 = {_xg,_yg}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 788 | return snakepos_b6; |
AhmedPlaymaker | 13:9785f2404045 | 789 | } |
AhmedPlaymaker | 13:9785f2404045 | 790 | else if(length==15) { |
AhmedPlaymaker | 13:9785f2404045 | 791 | Vector2D snakepos_b6 = {_xh,_yh}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 792 | return snakepos_b6; |
AhmedPlaymaker | 13:9785f2404045 | 793 | } |
AhmedPlaymaker | 13:9785f2404045 | 794 | //printf("snakepos from player = %f %f \n", snakepos.x, snakepos.y); |
AhmedPlaymaker | 13:9785f2404045 | 795 | else { |
AhmedPlaymaker | 13:9785f2404045 | 796 | Vector2D snakepos_b6 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 797 | return snakepos_b6; |
AhmedPlaymaker | 13:9785f2404045 | 798 | } |
AhmedPlaymaker | 13:9785f2404045 | 799 | } |
AhmedPlaymaker | 13:9785f2404045 | 800 | |
AhmedPlaymaker | 13:9785f2404045 | 801 | Vector2D Snake::get_pos_before7(int length) //this sends data of following sprites. |
AhmedPlaymaker | 13:9785f2404045 | 802 | { |
AhmedPlaymaker | 13:9785f2404045 | 803 | if(length == 1) { |
AhmedPlaymaker | 13:9785f2404045 | 804 | Vector2D snakepos_b7 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 805 | return snakepos_b7; |
AhmedPlaymaker | 13:9785f2404045 | 806 | } |
AhmedPlaymaker | 13:9785f2404045 | 807 | else if(length == 2) { |
AhmedPlaymaker | 13:9785f2404045 | 808 | Vector2D snakepos_b7 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 809 | return snakepos_b7; |
AhmedPlaymaker | 13:9785f2404045 | 810 | } |
AhmedPlaymaker | 13:9785f2404045 | 811 | else if(length == 3) { |
AhmedPlaymaker | 13:9785f2404045 | 812 | Vector2D snakepos_b7 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 813 | return snakepos_b7; |
AhmedPlaymaker | 13:9785f2404045 | 814 | } |
AhmedPlaymaker | 13:9785f2404045 | 815 | else if(length == 4) { |
AhmedPlaymaker | 13:9785f2404045 | 816 | Vector2D snakepos_b7 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 817 | return snakepos_b7; |
AhmedPlaymaker | 13:9785f2404045 | 818 | } |
AhmedPlaymaker | 13:9785f2404045 | 819 | else if(length == 5) { |
AhmedPlaymaker | 13:9785f2404045 | 820 | Vector2D snakepos_b7 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 821 | return snakepos_b7; |
AhmedPlaymaker | 13:9785f2404045 | 822 | } |
AhmedPlaymaker | 13:9785f2404045 | 823 | else if(length == 6) { |
AhmedPlaymaker | 13:9785f2404045 | 824 | Vector2D snakepos_b7 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 825 | return snakepos_b7; |
AhmedPlaymaker | 13:9785f2404045 | 826 | } |
AhmedPlaymaker | 13:9785f2404045 | 827 | else if(length == 7) { |
AhmedPlaymaker | 13:9785f2404045 | 828 | Vector2D snakepos_b7 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 829 | return snakepos_b7; |
AhmedPlaymaker | 13:9785f2404045 | 830 | } |
AhmedPlaymaker | 13:9785f2404045 | 831 | else if(length == 8) { |
AhmedPlaymaker | 13:9785f2404045 | 832 | Vector2D snakepos_b7 = {_x,_y}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 833 | return snakepos_b7; |
AhmedPlaymaker | 13:9785f2404045 | 834 | } |
AhmedPlaymaker | 13:9785f2404045 | 835 | else if(length==9) { |
AhmedPlaymaker | 13:9785f2404045 | 836 | Vector2D snakepos_b7 = {_xa,_ya}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 837 | return snakepos_b7; |
AhmedPlaymaker | 13:9785f2404045 | 838 | } |
AhmedPlaymaker | 13:9785f2404045 | 839 | else if(length==10) { |
AhmedPlaymaker | 13:9785f2404045 | 840 | Vector2D snakepos_b7 = {_xb,_yb}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 841 | return snakepos_b7; |
AhmedPlaymaker | 13:9785f2404045 | 842 | } |
AhmedPlaymaker | 13:9785f2404045 | 843 | else if(length==11) { |
AhmedPlaymaker | 13:9785f2404045 | 844 | Vector2D snakepos_b7 = {_xc,_yc}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 845 | return snakepos_b7; |
AhmedPlaymaker | 13:9785f2404045 | 846 | } |
AhmedPlaymaker | 13:9785f2404045 | 847 | else if(length==12) { |
AhmedPlaymaker | 13:9785f2404045 | 848 | Vector2D snakepos_b7 = {_xd,_yd}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 849 | return snakepos_b7; |
AhmedPlaymaker | 13:9785f2404045 | 850 | } |
AhmedPlaymaker | 13:9785f2404045 | 851 | else if(length==13) { |
AhmedPlaymaker | 13:9785f2404045 | 852 | Vector2D snakepos_b7 = {_xe,_ye}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 853 | return snakepos_b7; |
AhmedPlaymaker | 13:9785f2404045 | 854 | } |
AhmedPlaymaker | 13:9785f2404045 | 855 | else if(length==14) { |
AhmedPlaymaker | 13:9785f2404045 | 856 | Vector2D snakepos_b7 = {_xf,_yf}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 857 | return snakepos_b7; |
AhmedPlaymaker | 13:9785f2404045 | 858 | } |
AhmedPlaymaker | 13:9785f2404045 | 859 | else if(length==15) { |
AhmedPlaymaker | 13:9785f2404045 | 860 | Vector2D snakepos_b7 = {_xg,_yg}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 861 | return snakepos_b7; |
AhmedPlaymaker | 13:9785f2404045 | 862 | } |
AhmedPlaymaker | 13:9785f2404045 | 863 | //printf("snakepos from player = %f %f \n", snakepos.x, snakepos.y); |
AhmedPlaymaker | 13:9785f2404045 | 864 | else { |
AhmedPlaymaker | 13:9785f2404045 | 865 | Vector2D snakepos_b7 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 866 | return snakepos_b7; |
AhmedPlaymaker | 13:9785f2404045 | 867 | } |
AhmedPlaymaker | 7:48ba87cd79b5 | 868 | } |
AhmedPlaymaker | 7:48ba87cd79b5 | 869 | |
AhmedPlaymaker | 13:9785f2404045 | 870 | Vector2D Snake::get_pos_before8(int length) //this sends data of following sprites. |
AhmedPlaymaker | 13:9785f2404045 | 871 | { |
AhmedPlaymaker | 13:9785f2404045 | 872 | if(length == 1) { |
AhmedPlaymaker | 13:9785f2404045 | 873 | Vector2D snakepos_b8 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 874 | return snakepos_b8; |
AhmedPlaymaker | 13:9785f2404045 | 875 | } |
AhmedPlaymaker | 13:9785f2404045 | 876 | else if(length == 2) { |
AhmedPlaymaker | 13:9785f2404045 | 877 | Vector2D snakepos_b8 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 878 | return snakepos_b8; |
AhmedPlaymaker | 13:9785f2404045 | 879 | } |
AhmedPlaymaker | 13:9785f2404045 | 880 | else if(length == 3) { |
AhmedPlaymaker | 13:9785f2404045 | 881 | Vector2D snakepos_b8 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 882 | return snakepos_b8; |
AhmedPlaymaker | 13:9785f2404045 | 883 | } |
AhmedPlaymaker | 13:9785f2404045 | 884 | else if(length == 4) { |
AhmedPlaymaker | 13:9785f2404045 | 885 | Vector2D snakepos_b8 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 886 | return snakepos_b8; |
AhmedPlaymaker | 13:9785f2404045 | 887 | } |
AhmedPlaymaker | 13:9785f2404045 | 888 | else if(length == 5) { |
AhmedPlaymaker | 13:9785f2404045 | 889 | Vector2D snakepos_b8 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 890 | return snakepos_b8; |
AhmedPlaymaker | 13:9785f2404045 | 891 | } |
AhmedPlaymaker | 13:9785f2404045 | 892 | else if(length == 6) { |
AhmedPlaymaker | 13:9785f2404045 | 893 | Vector2D snakepos_b8 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 894 | return snakepos_b8; |
AhmedPlaymaker | 13:9785f2404045 | 895 | } |
AhmedPlaymaker | 13:9785f2404045 | 896 | else if(length == 7) { |
AhmedPlaymaker | 13:9785f2404045 | 897 | Vector2D snakepos_b8 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 898 | return snakepos_b8; |
AhmedPlaymaker | 13:9785f2404045 | 899 | } |
AhmedPlaymaker | 13:9785f2404045 | 900 | else if(length == 8) { |
AhmedPlaymaker | 13:9785f2404045 | 901 | Vector2D snakepos_b8 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 902 | return snakepos_b8; |
AhmedPlaymaker | 13:9785f2404045 | 903 | } |
AhmedPlaymaker | 13:9785f2404045 | 904 | else if(length == 9) { |
AhmedPlaymaker | 13:9785f2404045 | 905 | Vector2D snakepos_b8 = {_x,_y}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 906 | return snakepos_b8; |
AhmedPlaymaker | 13:9785f2404045 | 907 | } |
AhmedPlaymaker | 13:9785f2404045 | 908 | else if(length==10) { |
AhmedPlaymaker | 13:9785f2404045 | 909 | Vector2D snakepos_b8 = {_xa,_ya}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 910 | return snakepos_b8; |
AhmedPlaymaker | 13:9785f2404045 | 911 | } |
AhmedPlaymaker | 13:9785f2404045 | 912 | else if(length==11) { |
AhmedPlaymaker | 13:9785f2404045 | 913 | Vector2D snakepos_b8 = {_xb,_yb}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 914 | return snakepos_b8; |
AhmedPlaymaker | 13:9785f2404045 | 915 | } |
AhmedPlaymaker | 13:9785f2404045 | 916 | else if(length==12) { |
AhmedPlaymaker | 13:9785f2404045 | 917 | Vector2D snakepos_b8 = {_xc,_yc}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 918 | return snakepos_b8; |
AhmedPlaymaker | 13:9785f2404045 | 919 | } |
AhmedPlaymaker | 13:9785f2404045 | 920 | else if(length==13) { |
AhmedPlaymaker | 13:9785f2404045 | 921 | Vector2D snakepos_b8 = {_xd,_yd}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 922 | return snakepos_b8; |
AhmedPlaymaker | 13:9785f2404045 | 923 | } |
AhmedPlaymaker | 13:9785f2404045 | 924 | else if(length==14) { |
AhmedPlaymaker | 13:9785f2404045 | 925 | Vector2D snakepos_b8 = {_xe,_ye}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 926 | return snakepos_b8; |
AhmedPlaymaker | 13:9785f2404045 | 927 | } |
AhmedPlaymaker | 13:9785f2404045 | 928 | else if(length==15) { |
AhmedPlaymaker | 13:9785f2404045 | 929 | Vector2D snakepos_b8 = {_xf,_yf}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 930 | return snakepos_b8; |
AhmedPlaymaker | 13:9785f2404045 | 931 | } |
AhmedPlaymaker | 13:9785f2404045 | 932 | //printf("snakepos from player = %f %f \n", snakepos.x, snakepos.y); |
AhmedPlaymaker | 13:9785f2404045 | 933 | else { |
AhmedPlaymaker | 13:9785f2404045 | 934 | Vector2D snakepos_b8 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 935 | return snakepos_b8; |
AhmedPlaymaker | 13:9785f2404045 | 936 | } |
AhmedPlaymaker | 13:9785f2404045 | 937 | } |
AhmedPlaymaker | 7:48ba87cd79b5 | 938 | |
AhmedPlaymaker | 13:9785f2404045 | 939 | Vector2D Snake::get_pos_before9(int length) //this sends data of following sprites. |
AhmedPlaymaker | 13:9785f2404045 | 940 | { |
AhmedPlaymaker | 13:9785f2404045 | 941 | if(length == 1) { |
AhmedPlaymaker | 13:9785f2404045 | 942 | Vector2D snakepos_b9 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 943 | return snakepos_b9; |
AhmedPlaymaker | 13:9785f2404045 | 944 | } |
AhmedPlaymaker | 13:9785f2404045 | 945 | else if(length == 2) { |
AhmedPlaymaker | 13:9785f2404045 | 946 | Vector2D snakepos_b9 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 947 | return snakepos_b9; |
AhmedPlaymaker | 13:9785f2404045 | 948 | } |
AhmedPlaymaker | 13:9785f2404045 | 949 | else if(length == 3) { |
AhmedPlaymaker | 13:9785f2404045 | 950 | Vector2D snakepos_b9 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 951 | return snakepos_b9; |
AhmedPlaymaker | 13:9785f2404045 | 952 | } |
AhmedPlaymaker | 13:9785f2404045 | 953 | else if(length == 4) { |
AhmedPlaymaker | 13:9785f2404045 | 954 | Vector2D snakepos_b9 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 955 | return snakepos_b9; |
AhmedPlaymaker | 13:9785f2404045 | 956 | } |
AhmedPlaymaker | 13:9785f2404045 | 957 | else if(length == 5) { |
AhmedPlaymaker | 13:9785f2404045 | 958 | Vector2D snakepos_b9 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 959 | return snakepos_b9; |
AhmedPlaymaker | 13:9785f2404045 | 960 | } |
AhmedPlaymaker | 13:9785f2404045 | 961 | else if(length == 6) { |
AhmedPlaymaker | 13:9785f2404045 | 962 | Vector2D snakepos_b9 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 963 | return snakepos_b9; |
AhmedPlaymaker | 13:9785f2404045 | 964 | } |
AhmedPlaymaker | 13:9785f2404045 | 965 | else if(length == 7) { |
AhmedPlaymaker | 13:9785f2404045 | 966 | Vector2D snakepos_b9 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 967 | return snakepos_b9; |
AhmedPlaymaker | 13:9785f2404045 | 968 | } |
AhmedPlaymaker | 13:9785f2404045 | 969 | else if(length == 8) { |
AhmedPlaymaker | 13:9785f2404045 | 970 | Vector2D snakepos_b9 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 971 | return snakepos_b9; |
AhmedPlaymaker | 13:9785f2404045 | 972 | } |
AhmedPlaymaker | 13:9785f2404045 | 973 | else if(length == 9) { |
AhmedPlaymaker | 13:9785f2404045 | 974 | Vector2D snakepos_b9 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 975 | return snakepos_b9; |
AhmedPlaymaker | 13:9785f2404045 | 976 | } |
AhmedPlaymaker | 13:9785f2404045 | 977 | else if(length == 10) { |
AhmedPlaymaker | 13:9785f2404045 | 978 | Vector2D snakepos_b9 = {_x,_y}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 979 | return snakepos_b9; |
AhmedPlaymaker | 13:9785f2404045 | 980 | } |
AhmedPlaymaker | 13:9785f2404045 | 981 | else if(length==11) { |
AhmedPlaymaker | 13:9785f2404045 | 982 | Vector2D snakepos_b9 = {_xa,_ya}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 983 | return snakepos_b9; |
AhmedPlaymaker | 13:9785f2404045 | 984 | } |
AhmedPlaymaker | 13:9785f2404045 | 985 | else if(length==12) { |
AhmedPlaymaker | 13:9785f2404045 | 986 | Vector2D snakepos_b9 = {_xb,_yb}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 987 | return snakepos_b9; |
AhmedPlaymaker | 13:9785f2404045 | 988 | } |
AhmedPlaymaker | 13:9785f2404045 | 989 | else if(length==13) { |
AhmedPlaymaker | 13:9785f2404045 | 990 | Vector2D snakepos_b9 = {_xc,_yc}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 991 | return snakepos_b9; |
AhmedPlaymaker | 13:9785f2404045 | 992 | } |
AhmedPlaymaker | 13:9785f2404045 | 993 | else if(length==14) { |
AhmedPlaymaker | 13:9785f2404045 | 994 | Vector2D snakepos_b9 = {_xd,_yd}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 995 | return snakepos_b9; |
AhmedPlaymaker | 13:9785f2404045 | 996 | } |
AhmedPlaymaker | 13:9785f2404045 | 997 | else if(length==15) { |
AhmedPlaymaker | 13:9785f2404045 | 998 | Vector2D snakepos_b9 = {_xe,_ye}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 999 | return snakepos_b9; |
AhmedPlaymaker | 13:9785f2404045 | 1000 | } |
AhmedPlaymaker | 13:9785f2404045 | 1001 | //printf("snakepos from player = %f %f \n", snakepos.x, snakepos.y); |
AhmedPlaymaker | 13:9785f2404045 | 1002 | else { |
AhmedPlaymaker | 13:9785f2404045 | 1003 | Vector2D snakepos_b9 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 1004 | return snakepos_b9; |
AhmedPlaymaker | 13:9785f2404045 | 1005 | } |
AhmedPlaymaker | 13:9785f2404045 | 1006 | } |
AhmedPlaymaker | 13:9785f2404045 | 1007 | |
AhmedPlaymaker | 13:9785f2404045 | 1008 | Vector2D Snake::get_pos_before10(int length) //this sends data of following sprites. |
AhmedPlaymaker | 13:9785f2404045 | 1009 | { |
AhmedPlaymaker | 13:9785f2404045 | 1010 | if(length == 1) { |
AhmedPlaymaker | 13:9785f2404045 | 1011 | Vector2D snakepos_b10 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 1012 | return snakepos_b10; |
AhmedPlaymaker | 13:9785f2404045 | 1013 | } |
AhmedPlaymaker | 13:9785f2404045 | 1014 | else if(length == 2) { |
AhmedPlaymaker | 13:9785f2404045 | 1015 | Vector2D snakepos_b10 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 1016 | return snakepos_b10; |
AhmedPlaymaker | 13:9785f2404045 | 1017 | } |
AhmedPlaymaker | 13:9785f2404045 | 1018 | else if(length == 3) { |
AhmedPlaymaker | 13:9785f2404045 | 1019 | Vector2D snakepos_b10 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 1020 | return snakepos_b10; |
AhmedPlaymaker | 13:9785f2404045 | 1021 | } |
AhmedPlaymaker | 13:9785f2404045 | 1022 | else if(length == 4) { |
AhmedPlaymaker | 13:9785f2404045 | 1023 | Vector2D snakepos_b10 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 1024 | return snakepos_b10; |
AhmedPlaymaker | 13:9785f2404045 | 1025 | } |
AhmedPlaymaker | 13:9785f2404045 | 1026 | else if(length == 5) { |
AhmedPlaymaker | 13:9785f2404045 | 1027 | Vector2D snakepos_b10 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 1028 | return snakepos_b10; |
AhmedPlaymaker | 13:9785f2404045 | 1029 | } |
AhmedPlaymaker | 13:9785f2404045 | 1030 | else if(length == 6) { |
AhmedPlaymaker | 13:9785f2404045 | 1031 | Vector2D snakepos_b10 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 1032 | return snakepos_b10; |
AhmedPlaymaker | 13:9785f2404045 | 1033 | } |
AhmedPlaymaker | 13:9785f2404045 | 1034 | else if(length == 7) { |
AhmedPlaymaker | 13:9785f2404045 | 1035 | Vector2D snakepos_b10 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 1036 | return snakepos_b10; |
AhmedPlaymaker | 13:9785f2404045 | 1037 | } |
AhmedPlaymaker | 13:9785f2404045 | 1038 | else if(length == 8) { |
AhmedPlaymaker | 13:9785f2404045 | 1039 | Vector2D snakepos_b10 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 1040 | return snakepos_b10; |
AhmedPlaymaker | 13:9785f2404045 | 1041 | } |
AhmedPlaymaker | 13:9785f2404045 | 1042 | else if(length == 9) { |
AhmedPlaymaker | 13:9785f2404045 | 1043 | Vector2D snakepos_b10 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 1044 | return snakepos_b10; |
AhmedPlaymaker | 13:9785f2404045 | 1045 | } |
AhmedPlaymaker | 13:9785f2404045 | 1046 | else if(length == 10) { |
AhmedPlaymaker | 13:9785f2404045 | 1047 | Vector2D snakepos_b10 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 1048 | return snakepos_b10; |
AhmedPlaymaker | 13:9785f2404045 | 1049 | } |
AhmedPlaymaker | 13:9785f2404045 | 1050 | else if(length == 11) { |
AhmedPlaymaker | 13:9785f2404045 | 1051 | Vector2D snakepos_b10 = {_x,_y}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 1052 | return snakepos_b10; |
AhmedPlaymaker | 13:9785f2404045 | 1053 | } |
AhmedPlaymaker | 13:9785f2404045 | 1054 | else if(length==12) { |
AhmedPlaymaker | 13:9785f2404045 | 1055 | Vector2D snakepos_b10 = {_xa,_ya}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 1056 | return snakepos_b10; |
AhmedPlaymaker | 13:9785f2404045 | 1057 | } |
AhmedPlaymaker | 13:9785f2404045 | 1058 | else if(length==13) { |
AhmedPlaymaker | 13:9785f2404045 | 1059 | Vector2D snakepos_b10 = {_xb,_yb}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 1060 | return snakepos_b10; |
AhmedPlaymaker | 13:9785f2404045 | 1061 | } |
AhmedPlaymaker | 13:9785f2404045 | 1062 | else if(length==14) { |
AhmedPlaymaker | 13:9785f2404045 | 1063 | Vector2D snakepos_b10 = {_xc,_yc}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 1064 | return snakepos_b10; |
AhmedPlaymaker | 13:9785f2404045 | 1065 | } |
AhmedPlaymaker | 13:9785f2404045 | 1066 | else if(length==15) { |
AhmedPlaymaker | 13:9785f2404045 | 1067 | Vector2D snakepos_b10 = {_xd,_yd}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 1068 | return snakepos_b10; |
AhmedPlaymaker | 13:9785f2404045 | 1069 | } |
AhmedPlaymaker | 13:9785f2404045 | 1070 | //printf("snakepos from player = %f %f \n", snakepos.x, snakepos.y); |
AhmedPlaymaker | 13:9785f2404045 | 1071 | else { |
AhmedPlaymaker | 13:9785f2404045 | 1072 | Vector2D snakepos_b10 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 1073 | return snakepos_b10; |
AhmedPlaymaker | 13:9785f2404045 | 1074 | } |
AhmedPlaymaker | 13:9785f2404045 | 1075 | } |
AhmedPlaymaker | 13:9785f2404045 | 1076 | |
AhmedPlaymaker | 13:9785f2404045 | 1077 | Vector2D Snake::get_pos_before11(int length) //this sends data of following sprites. |
AhmedPlaymaker | 13:9785f2404045 | 1078 | { |
AhmedPlaymaker | 13:9785f2404045 | 1079 | if(length == 1) { |
AhmedPlaymaker | 13:9785f2404045 | 1080 | Vector2D snakepos_b11 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 1081 | return snakepos_b11; |
AhmedPlaymaker | 13:9785f2404045 | 1082 | } |
AhmedPlaymaker | 13:9785f2404045 | 1083 | else if(length == 2) { |
AhmedPlaymaker | 13:9785f2404045 | 1084 | Vector2D snakepos_b11 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 1085 | return snakepos_b11; |
AhmedPlaymaker | 13:9785f2404045 | 1086 | } |
AhmedPlaymaker | 13:9785f2404045 | 1087 | else if(length == 3) { |
AhmedPlaymaker | 13:9785f2404045 | 1088 | Vector2D snakepos_b11 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 1089 | return snakepos_b11; |
AhmedPlaymaker | 13:9785f2404045 | 1090 | } |
AhmedPlaymaker | 13:9785f2404045 | 1091 | else if(length == 4) { |
AhmedPlaymaker | 13:9785f2404045 | 1092 | Vector2D snakepos_b11 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 1093 | return snakepos_b11; |
AhmedPlaymaker | 13:9785f2404045 | 1094 | } |
AhmedPlaymaker | 13:9785f2404045 | 1095 | else if(length == 5) { |
AhmedPlaymaker | 13:9785f2404045 | 1096 | Vector2D snakepos_b11 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 1097 | return snakepos_b11; |
AhmedPlaymaker | 13:9785f2404045 | 1098 | } |
AhmedPlaymaker | 13:9785f2404045 | 1099 | else if(length == 6) { |
AhmedPlaymaker | 13:9785f2404045 | 1100 | Vector2D snakepos_b11 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 1101 | return snakepos_b11; |
AhmedPlaymaker | 13:9785f2404045 | 1102 | } |
AhmedPlaymaker | 13:9785f2404045 | 1103 | else if(length == 7) { |
AhmedPlaymaker | 13:9785f2404045 | 1104 | Vector2D snakepos_b11 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 1105 | return snakepos_b11; |
AhmedPlaymaker | 13:9785f2404045 | 1106 | } |
AhmedPlaymaker | 13:9785f2404045 | 1107 | else if(length == 8) { |
AhmedPlaymaker | 13:9785f2404045 | 1108 | Vector2D snakepos_b11 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 1109 | return snakepos_b11; |
AhmedPlaymaker | 13:9785f2404045 | 1110 | } |
AhmedPlaymaker | 13:9785f2404045 | 1111 | else if(length == 9) { |
AhmedPlaymaker | 13:9785f2404045 | 1112 | Vector2D snakepos_b11 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 1113 | return snakepos_b11; |
AhmedPlaymaker | 13:9785f2404045 | 1114 | } |
AhmedPlaymaker | 13:9785f2404045 | 1115 | else if(length == 10) { |
AhmedPlaymaker | 13:9785f2404045 | 1116 | Vector2D snakepos_b11 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 1117 | return snakepos_b11; |
AhmedPlaymaker | 13:9785f2404045 | 1118 | } |
AhmedPlaymaker | 13:9785f2404045 | 1119 | else if(length == 11) { |
AhmedPlaymaker | 13:9785f2404045 | 1120 | Vector2D snakepos_b11 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 1121 | return snakepos_b11; |
AhmedPlaymaker | 13:9785f2404045 | 1122 | } |
AhmedPlaymaker | 13:9785f2404045 | 1123 | else if(length == 12) { |
AhmedPlaymaker | 13:9785f2404045 | 1124 | Vector2D snakepos_b11 = {_x,_y}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 1125 | return snakepos_b11; |
AhmedPlaymaker | 13:9785f2404045 | 1126 | } |
AhmedPlaymaker | 13:9785f2404045 | 1127 | else if(length==13) { |
AhmedPlaymaker | 13:9785f2404045 | 1128 | Vector2D snakepos_b11 = {_xa,_ya}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 1129 | return snakepos_b11; |
AhmedPlaymaker | 13:9785f2404045 | 1130 | } |
AhmedPlaymaker | 13:9785f2404045 | 1131 | else if(length==14) { |
AhmedPlaymaker | 13:9785f2404045 | 1132 | Vector2D snakepos_b11 = {_xb,_yb}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 1133 | return snakepos_b11; |
AhmedPlaymaker | 13:9785f2404045 | 1134 | } |
AhmedPlaymaker | 13:9785f2404045 | 1135 | else if(length==15) { |
AhmedPlaymaker | 13:9785f2404045 | 1136 | Vector2D snakepos_b11 = {_xc,_yc}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 1137 | return snakepos_b11; |
AhmedPlaymaker | 13:9785f2404045 | 1138 | } |
AhmedPlaymaker | 13:9785f2404045 | 1139 | //printf("snakepos from player = %f %f \n", snakepos.x, snakepos.y); |
AhmedPlaymaker | 13:9785f2404045 | 1140 | else { |
AhmedPlaymaker | 13:9785f2404045 | 1141 | Vector2D snakepos_b11 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 1142 | return snakepos_b11; |
AhmedPlaymaker | 13:9785f2404045 | 1143 | } |
AhmedPlaymaker | 13:9785f2404045 | 1144 | } |
AhmedPlaymaker | 13:9785f2404045 | 1145 | |
AhmedPlaymaker | 13:9785f2404045 | 1146 | Vector2D Snake::get_pos_before12(int length) //this sends data of following sprites. |
AhmedPlaymaker | 7:48ba87cd79b5 | 1147 | { |
AhmedPlaymaker | 13:9785f2404045 | 1148 | if(length == 1) { |
AhmedPlaymaker | 13:9785f2404045 | 1149 | Vector2D snakepos_b12 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 1150 | return snakepos_b12; |
AhmedPlaymaker | 13:9785f2404045 | 1151 | } |
AhmedPlaymaker | 13:9785f2404045 | 1152 | else if(length == 2) { |
AhmedPlaymaker | 13:9785f2404045 | 1153 | Vector2D snakepos_b12 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 1154 | return snakepos_b12; |
AhmedPlaymaker | 13:9785f2404045 | 1155 | } |
AhmedPlaymaker | 13:9785f2404045 | 1156 | else if(length == 3) { |
AhmedPlaymaker | 13:9785f2404045 | 1157 | Vector2D snakepos_b12 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 1158 | return snakepos_b12; |
AhmedPlaymaker | 13:9785f2404045 | 1159 | } |
AhmedPlaymaker | 13:9785f2404045 | 1160 | else if(length == 4) { |
AhmedPlaymaker | 13:9785f2404045 | 1161 | Vector2D snakepos_b12 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 1162 | return snakepos_b12; |
AhmedPlaymaker | 13:9785f2404045 | 1163 | } |
AhmedPlaymaker | 13:9785f2404045 | 1164 | else if(length == 5) { |
AhmedPlaymaker | 13:9785f2404045 | 1165 | Vector2D snakepos_b12 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 1166 | return snakepos_b12; |
AhmedPlaymaker | 13:9785f2404045 | 1167 | } |
AhmedPlaymaker | 13:9785f2404045 | 1168 | else if(length == 6) { |
AhmedPlaymaker | 13:9785f2404045 | 1169 | Vector2D snakepos_b12 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 1170 | return snakepos_b12; |
AhmedPlaymaker | 13:9785f2404045 | 1171 | } |
AhmedPlaymaker | 13:9785f2404045 | 1172 | else if(length == 7) { |
AhmedPlaymaker | 13:9785f2404045 | 1173 | Vector2D snakepos_b12 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 1174 | return snakepos_b12; |
AhmedPlaymaker | 13:9785f2404045 | 1175 | } |
AhmedPlaymaker | 13:9785f2404045 | 1176 | else if(length == 8) { |
AhmedPlaymaker | 13:9785f2404045 | 1177 | Vector2D snakepos_b12 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 1178 | return snakepos_b12; |
AhmedPlaymaker | 13:9785f2404045 | 1179 | } |
AhmedPlaymaker | 13:9785f2404045 | 1180 | else if(length == 9) { |
AhmedPlaymaker | 13:9785f2404045 | 1181 | Vector2D snakepos_b12 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 1182 | return snakepos_b12; |
AhmedPlaymaker | 13:9785f2404045 | 1183 | } |
AhmedPlaymaker | 13:9785f2404045 | 1184 | else if(length == 10) { |
AhmedPlaymaker | 13:9785f2404045 | 1185 | Vector2D snakepos_b12 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 1186 | return snakepos_b12; |
AhmedPlaymaker | 13:9785f2404045 | 1187 | } |
AhmedPlaymaker | 13:9785f2404045 | 1188 | else if(length == 11) { |
AhmedPlaymaker | 13:9785f2404045 | 1189 | Vector2D snakepos_b12 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 1190 | return snakepos_b12; |
AhmedPlaymaker | 13:9785f2404045 | 1191 | } |
AhmedPlaymaker | 13:9785f2404045 | 1192 | else if(length == 12) { |
AhmedPlaymaker | 13:9785f2404045 | 1193 | Vector2D snakepos_b12 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 1194 | return snakepos_b12; |
AhmedPlaymaker | 13:9785f2404045 | 1195 | } |
AhmedPlaymaker | 13:9785f2404045 | 1196 | else if(length == 13) { |
AhmedPlaymaker | 13:9785f2404045 | 1197 | Vector2D snakepos_b12 = {_x,_y}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 1198 | return snakepos_b12; |
AhmedPlaymaker | 13:9785f2404045 | 1199 | } |
AhmedPlaymaker | 13:9785f2404045 | 1200 | else if(length==14) { |
AhmedPlaymaker | 13:9785f2404045 | 1201 | Vector2D snakepos_b12 = {_xa,_ya}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 1202 | return snakepos_b12; |
AhmedPlaymaker | 13:9785f2404045 | 1203 | } |
AhmedPlaymaker | 13:9785f2404045 | 1204 | else if(length==15) { |
AhmedPlaymaker | 13:9785f2404045 | 1205 | Vector2D snakepos_b12 = {_xb,_yb}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 1206 | return snakepos_b12; |
AhmedPlaymaker | 13:9785f2404045 | 1207 | } |
AhmedPlaymaker | 13:9785f2404045 | 1208 | //printf("snakepos from player = %f %f \n", snakepos.x, snakepos.y); |
AhmedPlaymaker | 13:9785f2404045 | 1209 | else { |
AhmedPlaymaker | 13:9785f2404045 | 1210 | Vector2D snakepos_b12 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 1211 | return snakepos_b12; |
AhmedPlaymaker | 13:9785f2404045 | 1212 | } |
AhmedPlaymaker | 13:9785f2404045 | 1213 | } |
AhmedPlaymaker | 13:9785f2404045 | 1214 | |
AhmedPlaymaker | 13:9785f2404045 | 1215 | Vector2D Snake::get_pos_before13(int length) //this sends data of following sprites. |
AhmedPlaymaker | 13:9785f2404045 | 1216 | { |
AhmedPlaymaker | 13:9785f2404045 | 1217 | if(length == 1) { |
AhmedPlaymaker | 13:9785f2404045 | 1218 | Vector2D snakepos_b13 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 1219 | return snakepos_b13; |
AhmedPlaymaker | 13:9785f2404045 | 1220 | } |
AhmedPlaymaker | 13:9785f2404045 | 1221 | else if(length == 2) { |
AhmedPlaymaker | 13:9785f2404045 | 1222 | Vector2D snakepos_b13 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 1223 | return snakepos_b13; |
AhmedPlaymaker | 13:9785f2404045 | 1224 | } |
AhmedPlaymaker | 13:9785f2404045 | 1225 | else if(length == 3) { |
AhmedPlaymaker | 13:9785f2404045 | 1226 | Vector2D snakepos_b13 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 1227 | return snakepos_b13; |
AhmedPlaymaker | 13:9785f2404045 | 1228 | } |
AhmedPlaymaker | 13:9785f2404045 | 1229 | else if(length == 4) { |
AhmedPlaymaker | 13:9785f2404045 | 1230 | Vector2D snakepos_b13 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 1231 | return snakepos_b13; |
AhmedPlaymaker | 13:9785f2404045 | 1232 | } |
AhmedPlaymaker | 13:9785f2404045 | 1233 | else if(length == 5) { |
AhmedPlaymaker | 13:9785f2404045 | 1234 | Vector2D snakepos_b13 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 1235 | return snakepos_b13; |
AhmedPlaymaker | 13:9785f2404045 | 1236 | } |
AhmedPlaymaker | 13:9785f2404045 | 1237 | else if(length == 6) { |
AhmedPlaymaker | 13:9785f2404045 | 1238 | Vector2D snakepos_b13 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 1239 | return snakepos_b13; |
AhmedPlaymaker | 13:9785f2404045 | 1240 | } |
AhmedPlaymaker | 13:9785f2404045 | 1241 | else if(length == 7) { |
AhmedPlaymaker | 13:9785f2404045 | 1242 | Vector2D snakepos_b13 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 1243 | return snakepos_b13; |
AhmedPlaymaker | 13:9785f2404045 | 1244 | } |
AhmedPlaymaker | 13:9785f2404045 | 1245 | else if(length == 8) { |
AhmedPlaymaker | 13:9785f2404045 | 1246 | Vector2D snakepos_b13 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 1247 | return snakepos_b13; |
AhmedPlaymaker | 13:9785f2404045 | 1248 | } |
AhmedPlaymaker | 13:9785f2404045 | 1249 | else if(length == 9) { |
AhmedPlaymaker | 13:9785f2404045 | 1250 | Vector2D snakepos_b13 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 1251 | return snakepos_b13; |
AhmedPlaymaker | 13:9785f2404045 | 1252 | } |
AhmedPlaymaker | 13:9785f2404045 | 1253 | else if(length == 10) { |
AhmedPlaymaker | 13:9785f2404045 | 1254 | Vector2D snakepos_b13 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 1255 | return snakepos_b13; |
AhmedPlaymaker | 13:9785f2404045 | 1256 | } |
AhmedPlaymaker | 13:9785f2404045 | 1257 | else if(length == 11) { |
AhmedPlaymaker | 13:9785f2404045 | 1258 | Vector2D snakepos_b13 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 1259 | return snakepos_b13; |
AhmedPlaymaker | 13:9785f2404045 | 1260 | } |
AhmedPlaymaker | 13:9785f2404045 | 1261 | else if(length == 12) { |
AhmedPlaymaker | 13:9785f2404045 | 1262 | Vector2D snakepos_b13 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 1263 | return snakepos_b13; |
AhmedPlaymaker | 13:9785f2404045 | 1264 | } |
AhmedPlaymaker | 13:9785f2404045 | 1265 | else if(length == 13) { |
AhmedPlaymaker | 13:9785f2404045 | 1266 | Vector2D snakepos_b13 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 1267 | return snakepos_b13; |
AhmedPlaymaker | 13:9785f2404045 | 1268 | } |
AhmedPlaymaker | 13:9785f2404045 | 1269 | else if(length == 14) { |
AhmedPlaymaker | 13:9785f2404045 | 1270 | Vector2D snakepos_b13 = {_x,_y}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 1271 | return snakepos_b13; |
AhmedPlaymaker | 13:9785f2404045 | 1272 | } |
AhmedPlaymaker | 13:9785f2404045 | 1273 | else if(length==15) { |
AhmedPlaymaker | 13:9785f2404045 | 1274 | Vector2D snakepos_b13 = {_xa,_ya}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 1275 | return snakepos_b13; |
AhmedPlaymaker | 13:9785f2404045 | 1276 | } |
AhmedPlaymaker | 13:9785f2404045 | 1277 | //printf("snakepos from player = %f %f \n", snakepos.x, snakepos.y); |
AhmedPlaymaker | 13:9785f2404045 | 1278 | else { |
AhmedPlaymaker | 13:9785f2404045 | 1279 | Vector2D snakepos_b13 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 1280 | return snakepos_b13; |
AhmedPlaymaker | 13:9785f2404045 | 1281 | } |
AhmedPlaymaker | 13:9785f2404045 | 1282 | } |
AhmedPlaymaker | 13:9785f2404045 | 1283 | |
AhmedPlaymaker | 13:9785f2404045 | 1284 | Vector2D Snake::get_pos_before14(int length) //this sends data of following sprites. |
AhmedPlaymaker | 13:9785f2404045 | 1285 | { |
AhmedPlaymaker | 13:9785f2404045 | 1286 | if(length == 1) { |
AhmedPlaymaker | 13:9785f2404045 | 1287 | Vector2D snakepos_b14 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 1288 | return snakepos_b14; |
AhmedPlaymaker | 13:9785f2404045 | 1289 | } |
AhmedPlaymaker | 13:9785f2404045 | 1290 | else if(length == 2) { |
AhmedPlaymaker | 13:9785f2404045 | 1291 | Vector2D snakepos_b14 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 1292 | return snakepos_b14; |
AhmedPlaymaker | 13:9785f2404045 | 1293 | } |
AhmedPlaymaker | 13:9785f2404045 | 1294 | else if(length == 3) { |
AhmedPlaymaker | 13:9785f2404045 | 1295 | Vector2D snakepos_b14 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 1296 | return snakepos_b14; |
AhmedPlaymaker | 13:9785f2404045 | 1297 | } |
AhmedPlaymaker | 13:9785f2404045 | 1298 | else if(length == 4) { |
AhmedPlaymaker | 13:9785f2404045 | 1299 | Vector2D snakepos_b14 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 1300 | return snakepos_b14; |
AhmedPlaymaker | 13:9785f2404045 | 1301 | } |
AhmedPlaymaker | 13:9785f2404045 | 1302 | else if(length == 5) { |
AhmedPlaymaker | 13:9785f2404045 | 1303 | Vector2D snakepos_b14 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 1304 | return snakepos_b14; |
AhmedPlaymaker | 13:9785f2404045 | 1305 | } |
AhmedPlaymaker | 13:9785f2404045 | 1306 | else if(length == 6) { |
AhmedPlaymaker | 13:9785f2404045 | 1307 | Vector2D snakepos_b14 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 1308 | return snakepos_b14; |
AhmedPlaymaker | 13:9785f2404045 | 1309 | } |
AhmedPlaymaker | 13:9785f2404045 | 1310 | else if(length == 7) { |
AhmedPlaymaker | 13:9785f2404045 | 1311 | Vector2D snakepos_b14 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 1312 | return snakepos_b14; |
AhmedPlaymaker | 13:9785f2404045 | 1313 | } |
AhmedPlaymaker | 13:9785f2404045 | 1314 | else if(length == 8) { |
AhmedPlaymaker | 13:9785f2404045 | 1315 | Vector2D snakepos_b14 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 1316 | return snakepos_b14; |
AhmedPlaymaker | 13:9785f2404045 | 1317 | } |
AhmedPlaymaker | 13:9785f2404045 | 1318 | else if(length == 9) { |
AhmedPlaymaker | 13:9785f2404045 | 1319 | Vector2D snakepos_b14 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 1320 | return snakepos_b14; |
AhmedPlaymaker | 13:9785f2404045 | 1321 | } |
AhmedPlaymaker | 13:9785f2404045 | 1322 | else if(length == 10) { |
AhmedPlaymaker | 13:9785f2404045 | 1323 | Vector2D snakepos_b14 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 1324 | return snakepos_b14; |
AhmedPlaymaker | 13:9785f2404045 | 1325 | } |
AhmedPlaymaker | 13:9785f2404045 | 1326 | else if(length == 11) { |
AhmedPlaymaker | 13:9785f2404045 | 1327 | Vector2D snakepos_b14 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 1328 | return snakepos_b14; |
AhmedPlaymaker | 13:9785f2404045 | 1329 | } |
AhmedPlaymaker | 13:9785f2404045 | 1330 | else if(length == 12) { |
AhmedPlaymaker | 13:9785f2404045 | 1331 | Vector2D snakepos_b14 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 1332 | return snakepos_b14; |
AhmedPlaymaker | 13:9785f2404045 | 1333 | } |
AhmedPlaymaker | 13:9785f2404045 | 1334 | else if(length == 13) { |
AhmedPlaymaker | 13:9785f2404045 | 1335 | Vector2D snakepos_b14 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 1336 | return snakepos_b14; |
AhmedPlaymaker | 13:9785f2404045 | 1337 | } |
AhmedPlaymaker | 13:9785f2404045 | 1338 | else if(length == 14) { |
AhmedPlaymaker | 13:9785f2404045 | 1339 | Vector2D snakepos_b14 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 1340 | return snakepos_b14; |
AhmedPlaymaker | 13:9785f2404045 | 1341 | } |
AhmedPlaymaker | 13:9785f2404045 | 1342 | else if(length==15) { |
AhmedPlaymaker | 13:9785f2404045 | 1343 | Vector2D snakepos_b14 = {_x,_y}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 1344 | return snakepos_b14; |
AhmedPlaymaker | 13:9785f2404045 | 1345 | } |
AhmedPlaymaker | 13:9785f2404045 | 1346 | //printf("snakepos from player = %f %f \n", snakepos.x, snakepos.y); |
AhmedPlaymaker | 13:9785f2404045 | 1347 | else { |
AhmedPlaymaker | 13:9785f2404045 | 1348 | Vector2D snakepos_b14 = {-20,-20}; //Obtains the snake position. |
AhmedPlaymaker | 13:9785f2404045 | 1349 | return snakepos_b14; |
AhmedPlaymaker | 13:9785f2404045 | 1350 | } |
AhmedPlaymaker | 13:9785f2404045 | 1351 | } |
AhmedPlaymaker | 13:9785f2404045 | 1352 | |
AhmedPlaymaker | 18:b391caa5754c | 1353 | |
AhmedPlaymaker | 13:9785f2404045 | 1354 | |
AhmedPlaymaker | 18:b391caa5754c | 1355 | void Snake::update(Direction d,float mag,int length, int speed, int* b0_to_b14) |
AhmedPlaymaker | 13:9785f2404045 | 1356 | { |
AhmedPlaymaker | 13:9785f2404045 | 1357 | _speed = speed; //Speed changes depending on how much you push the joystick.(As Of Now) |
AhmedPlaymaker | 18:b391caa5754c | 1358 | b0 = b0_to_b14[0]; |
AhmedPlaymaker | 18:b391caa5754c | 1359 | b1 = b0_to_b14[1]; |
AhmedPlaymaker | 18:b391caa5754c | 1360 | b2 = b0_to_b14[2]; |
AhmedPlaymaker | 18:b391caa5754c | 1361 | b3 = b0_to_b14[3]; |
AhmedPlaymaker | 18:b391caa5754c | 1362 | b4 = b0_to_b14[4]; |
AhmedPlaymaker | 18:b391caa5754c | 1363 | b5 = b0_to_b14[5]; |
AhmedPlaymaker | 18:b391caa5754c | 1364 | b6 = b0_to_b14[6]; |
AhmedPlaymaker | 18:b391caa5754c | 1365 | b7 = b0_to_b14[7]; |
AhmedPlaymaker | 18:b391caa5754c | 1366 | b8 = b0_to_b14[8]; |
AhmedPlaymaker | 18:b391caa5754c | 1367 | b9 = b0_to_b14[9]; |
AhmedPlaymaker | 18:b391caa5754c | 1368 | b10 = b0_to_b14[10]; |
AhmedPlaymaker | 18:b391caa5754c | 1369 | b11 = b0_to_b14[11]; |
AhmedPlaymaker | 18:b391caa5754c | 1370 | b12 = b0_to_b14[12]; |
AhmedPlaymaker | 18:b391caa5754c | 1371 | b13 = b0_to_b14[13]; |
AhmedPlaymaker | 18:b391caa5754c | 1372 | b14 = b0_to_b14[14]; |
AhmedPlaymaker | 8:890b986b16a4 | 1373 | |
AhmedPlaymaker | 8:890b986b16a4 | 1374 | if(length > 1) { |
AhmedPlaymaker | 18:b391caa5754c | 1375 | if ((_x > _xa)&&(b1 == 1)&&(b0 == 1)) { |
AhmedPlaymaker | 8:890b986b16a4 | 1376 | _x-=_speed; |
AhmedPlaymaker | 8:890b986b16a4 | 1377 | } |
AhmedPlaymaker | 18:b391caa5754c | 1378 | if ((_x < _xa)&&(b1 == 1)&&(b0 == 1)) { |
AhmedPlaymaker | 8:890b986b16a4 | 1379 | _x+=_speed; |
AhmedPlaymaker | 8:890b986b16a4 | 1380 | } |
AhmedPlaymaker | 8:890b986b16a4 | 1381 | if(length > 2) { |
AhmedPlaymaker | 18:b391caa5754c | 1382 | if ((_xa > _xb)&&(b2 == 1)&&(b1 == 1)) { |
AhmedPlaymaker | 8:890b986b16a4 | 1383 | _xa-=_speed; |
AhmedPlaymaker | 8:890b986b16a4 | 1384 | } |
AhmedPlaymaker | 18:b391caa5754c | 1385 | if ((_xa < _xb)&&(b2 == 1)&&(b1 == 1)) { |
AhmedPlaymaker | 8:890b986b16a4 | 1386 | _xa+=_speed; |
AhmedPlaymaker | 8:890b986b16a4 | 1387 | } |
AhmedPlaymaker | 8:890b986b16a4 | 1388 | if(length > 3) { |
AhmedPlaymaker | 18:b391caa5754c | 1389 | if ((_xb > _xc)&&(b3 == 1)&&(b2 == 1)) { |
AhmedPlaymaker | 8:890b986b16a4 | 1390 | _xb-=_speed; |
AhmedPlaymaker | 8:890b986b16a4 | 1391 | } |
AhmedPlaymaker | 18:b391caa5754c | 1392 | if ((_xb < _xc)&&(b3 == 1)&&(b2 == 1)) { |
AhmedPlaymaker | 8:890b986b16a4 | 1393 | _xb+=_speed; |
AhmedPlaymaker | 8:890b986b16a4 | 1394 | } |
AhmedPlaymaker | 8:890b986b16a4 | 1395 | if(length > 4) { |
AhmedPlaymaker | 18:b391caa5754c | 1396 | if ((_xc > _xd)&&(b4 == 1)&&(b3 == 1)) { |
AhmedPlaymaker | 8:890b986b16a4 | 1397 | _xc-=_speed; |
AhmedPlaymaker | 8:890b986b16a4 | 1398 | } |
AhmedPlaymaker | 18:b391caa5754c | 1399 | if ((_xc < _xd)&&(b4 == 1)&&(b3 == 1)) { |
AhmedPlaymaker | 8:890b986b16a4 | 1400 | _xc+=_speed; |
AhmedPlaymaker | 8:890b986b16a4 | 1401 | } |
AhmedPlaymaker | 8:890b986b16a4 | 1402 | if(length > 5) { |
AhmedPlaymaker | 18:b391caa5754c | 1403 | if ((_xd > _xe)&&(b5 == 1)&&(b4 == 1)) { |
AhmedPlaymaker | 8:890b986b16a4 | 1404 | _xd-=_speed; |
AhmedPlaymaker | 8:890b986b16a4 | 1405 | } |
AhmedPlaymaker | 18:b391caa5754c | 1406 | if ((_xd < _xe)&&(b5 == 1)&&(b4 == 1)) { |
AhmedPlaymaker | 8:890b986b16a4 | 1407 | _xd+=_speed; |
AhmedPlaymaker | 8:890b986b16a4 | 1408 | } |
AhmedPlaymaker | 8:890b986b16a4 | 1409 | if(length > 6) { |
AhmedPlaymaker | 18:b391caa5754c | 1410 | if ((_xe > _xf)&&(b6 == 1)&&(b5 == 1)) { |
AhmedPlaymaker | 8:890b986b16a4 | 1411 | _xe-=_speed; |
AhmedPlaymaker | 8:890b986b16a4 | 1412 | } |
AhmedPlaymaker | 18:b391caa5754c | 1413 | if ((_xe < _xf)&&(b6 == 1)&&(b5 == 1)) { |
AhmedPlaymaker | 8:890b986b16a4 | 1414 | _xe+=_speed; |
AhmedPlaymaker | 8:890b986b16a4 | 1415 | } |
AhmedPlaymaker | 8:890b986b16a4 | 1416 | if(length > 7) { |
AhmedPlaymaker | 18:b391caa5754c | 1417 | if ((_xf > _xg)&&(b7 == 1)&&(b6 == 1)) { |
AhmedPlaymaker | 8:890b986b16a4 | 1418 | _xf-=_speed; |
AhmedPlaymaker | 8:890b986b16a4 | 1419 | } |
AhmedPlaymaker | 18:b391caa5754c | 1420 | if ((_xf < _xg)&&(b7 == 1)&&(b6 == 1)) { |
AhmedPlaymaker | 8:890b986b16a4 | 1421 | _xf+=_speed; |
AhmedPlaymaker | 8:890b986b16a4 | 1422 | } |
AhmedPlaymaker | 8:890b986b16a4 | 1423 | if(length > 8) { |
AhmedPlaymaker | 18:b391caa5754c | 1424 | if ((_xg > _xh)&&(b8 == 1)&&(b7 == 1)) { |
AhmedPlaymaker | 8:890b986b16a4 | 1425 | _xg-=_speed; |
AhmedPlaymaker | 8:890b986b16a4 | 1426 | } |
AhmedPlaymaker | 18:b391caa5754c | 1427 | if ((_xg < _xh)&&(b8 == 1)&&(b7 == 1)) { |
AhmedPlaymaker | 8:890b986b16a4 | 1428 | _xg+=_speed; |
AhmedPlaymaker | 8:890b986b16a4 | 1429 | } |
AhmedPlaymaker | 8:890b986b16a4 | 1430 | if(length > 9) { |
AhmedPlaymaker | 18:b391caa5754c | 1431 | if ((_xh > _xi)&&(b9 == 1)&&(b8 == 1)) { |
AhmedPlaymaker | 8:890b986b16a4 | 1432 | _xh-=_speed; |
AhmedPlaymaker | 8:890b986b16a4 | 1433 | } |
AhmedPlaymaker | 18:b391caa5754c | 1434 | if ((_xh < _xi)&&(b9 == 1)&&(b8 == 1)) { |
AhmedPlaymaker | 8:890b986b16a4 | 1435 | _xh+=_speed; |
AhmedPlaymaker | 8:890b986b16a4 | 1436 | } |
AhmedPlaymaker | 8:890b986b16a4 | 1437 | if(length > 10) { |
AhmedPlaymaker | 18:b391caa5754c | 1438 | if ((_xi > _xj)&&(b10 == 1)&&(b9 == 1)) { |
AhmedPlaymaker | 8:890b986b16a4 | 1439 | _xi-=_speed; |
AhmedPlaymaker | 8:890b986b16a4 | 1440 | } |
AhmedPlaymaker | 18:b391caa5754c | 1441 | if ((_xi < _xj)&&(b10 == 1)&&(b9 == 1)) { |
AhmedPlaymaker | 8:890b986b16a4 | 1442 | _xi+=_speed; |
AhmedPlaymaker | 8:890b986b16a4 | 1443 | } |
AhmedPlaymaker | 8:890b986b16a4 | 1444 | if(length > 11) { |
AhmedPlaymaker | 18:b391caa5754c | 1445 | if ((_xj > _xk)&&(b11 == 1)&&(b10 == 1)) { |
AhmedPlaymaker | 8:890b986b16a4 | 1446 | _xj-=_speed; |
AhmedPlaymaker | 8:890b986b16a4 | 1447 | } |
AhmedPlaymaker | 18:b391caa5754c | 1448 | if ((_xj < _xk)&&(b11 == 1)&&(b10 == 1)) { |
AhmedPlaymaker | 8:890b986b16a4 | 1449 | _xj+=_speed; |
AhmedPlaymaker | 8:890b986b16a4 | 1450 | } |
AhmedPlaymaker | 8:890b986b16a4 | 1451 | if(length > 12) { |
AhmedPlaymaker | 18:b391caa5754c | 1452 | if ((_xk > _xl)&&(b12 == 1)&&(b11 == 1)) { |
AhmedPlaymaker | 8:890b986b16a4 | 1453 | _xk-=_speed; |
AhmedPlaymaker | 8:890b986b16a4 | 1454 | } |
AhmedPlaymaker | 18:b391caa5754c | 1455 | if ((_xk < _xl)&&(b12 == 1)&&(b11 == 1)) { |
AhmedPlaymaker | 8:890b986b16a4 | 1456 | _xk+=_speed; |
AhmedPlaymaker | 8:890b986b16a4 | 1457 | } |
AhmedPlaymaker | 8:890b986b16a4 | 1458 | if(length > 13) { |
AhmedPlaymaker | 18:b391caa5754c | 1459 | if ((_xl > _xm)&&(b13 == 1)&&(b12 == 1)) { |
AhmedPlaymaker | 8:890b986b16a4 | 1460 | _xl-=_speed; |
AhmedPlaymaker | 8:890b986b16a4 | 1461 | } |
AhmedPlaymaker | 18:b391caa5754c | 1462 | if ((_xl < _xm)&&(b13 == 1)&&(b12 == 1)) { |
AhmedPlaymaker | 8:890b986b16a4 | 1463 | _xl+=_speed; |
AhmedPlaymaker | 8:890b986b16a4 | 1464 | } |
AhmedPlaymaker | 8:890b986b16a4 | 1465 | if(length > 14) { |
AhmedPlaymaker | 18:b391caa5754c | 1466 | if ((_xm > _xn)&&(b14 == 1)&&(b13 == 1)) { |
AhmedPlaymaker | 8:890b986b16a4 | 1467 | _xm-=_speed; |
AhmedPlaymaker | 8:890b986b16a4 | 1468 | } |
AhmedPlaymaker | 18:b391caa5754c | 1469 | if ((_xm < _xn)&&(b14 == 1)&&(b13 == 1)) { |
AhmedPlaymaker | 18:b391caa5754c | 1470 | _xm+=_speed; |
AhmedPlaymaker | 18:b391caa5754c | 1471 | |
AhmedPlaymaker | 8:890b986b16a4 | 1472 | } |
AhmedPlaymaker | 8:890b986b16a4 | 1473 | } |
AhmedPlaymaker | 8:890b986b16a4 | 1474 | } |
AhmedPlaymaker | 8:890b986b16a4 | 1475 | } |
AhmedPlaymaker | 8:890b986b16a4 | 1476 | } |
AhmedPlaymaker | 8:890b986b16a4 | 1477 | } |
AhmedPlaymaker | 8:890b986b16a4 | 1478 | } |
AhmedPlaymaker | 8:890b986b16a4 | 1479 | } |
AhmedPlaymaker | 8:890b986b16a4 | 1480 | } |
AhmedPlaymaker | 8:890b986b16a4 | 1481 | } |
AhmedPlaymaker | 8:890b986b16a4 | 1482 | } |
AhmedPlaymaker | 8:890b986b16a4 | 1483 | } |
AhmedPlaymaker | 8:890b986b16a4 | 1484 | } |
AhmedPlaymaker | 8:890b986b16a4 | 1485 | } |
AhmedPlaymaker | 8:890b986b16a4 | 1486 | } |
AhmedPlaymaker | 18:b391caa5754c | 1487 | if((length == 15)&&(b14 == 1)) { |
AhmedPlaymaker | 8:890b986b16a4 | 1488 | if (d == E) { |
AhmedPlaymaker | 8:890b986b16a4 | 1489 | _xn+= _speed; |
AhmedPlaymaker | 8:890b986b16a4 | 1490 | } |
AhmedPlaymaker | 8:890b986b16a4 | 1491 | if (d == W) { |
AhmedPlaymaker | 8:890b986b16a4 | 1492 | _xn-= _speed; |
AhmedPlaymaker | 8:890b986b16a4 | 1493 | } |
AhmedPlaymaker | 8:890b986b16a4 | 1494 | } |
AhmedPlaymaker | 18:b391caa5754c | 1495 | if((length == 14)&&(b13 == 1)) { |
AhmedPlaymaker | 8:890b986b16a4 | 1496 | if (d == E) { |
AhmedPlaymaker | 8:890b986b16a4 | 1497 | _xm+= _speed; |
AhmedPlaymaker | 8:890b986b16a4 | 1498 | } |
AhmedPlaymaker | 8:890b986b16a4 | 1499 | if (d == W) { |
AhmedPlaymaker | 8:890b986b16a4 | 1500 | _xm-= _speed; |
AhmedPlaymaker | 8:890b986b16a4 | 1501 | } |
AhmedPlaymaker | 8:890b986b16a4 | 1502 | } |
AhmedPlaymaker | 18:b391caa5754c | 1503 | if((length == 13)&&(b12 == 1)) { |
AhmedPlaymaker | 8:890b986b16a4 | 1504 | if (d == E) { |
AhmedPlaymaker | 8:890b986b16a4 | 1505 | _xl+= _speed; |
AhmedPlaymaker | 8:890b986b16a4 | 1506 | } |
AhmedPlaymaker | 8:890b986b16a4 | 1507 | if (d == W) { |
AhmedPlaymaker | 8:890b986b16a4 | 1508 | _xl-= _speed; |
AhmedPlaymaker | 8:890b986b16a4 | 1509 | } |
AhmedPlaymaker | 8:890b986b16a4 | 1510 | } |
AhmedPlaymaker | 18:b391caa5754c | 1511 | if((length == 12)&&(b11 == 1)) { |
AhmedPlaymaker | 8:890b986b16a4 | 1512 | if (d == E) { |
AhmedPlaymaker | 8:890b986b16a4 | 1513 | _xk+= _speed; |
AhmedPlaymaker | 8:890b986b16a4 | 1514 | } |
AhmedPlaymaker | 8:890b986b16a4 | 1515 | if (d == W) { |
AhmedPlaymaker | 8:890b986b16a4 | 1516 | _xk-= _speed; |
AhmedPlaymaker | 8:890b986b16a4 | 1517 | } |
AhmedPlaymaker | 8:890b986b16a4 | 1518 | } |
AhmedPlaymaker | 18:b391caa5754c | 1519 | if((length == 11)&&(b10 == 1)) { |
AhmedPlaymaker | 8:890b986b16a4 | 1520 | if (d == E) { |
AhmedPlaymaker | 8:890b986b16a4 | 1521 | _xj+= _speed; |
AhmedPlaymaker | 8:890b986b16a4 | 1522 | } |
AhmedPlaymaker | 8:890b986b16a4 | 1523 | if (d == W) { |
AhmedPlaymaker | 8:890b986b16a4 | 1524 | _xj-= _speed; |
AhmedPlaymaker | 8:890b986b16a4 | 1525 | } |
AhmedPlaymaker | 8:890b986b16a4 | 1526 | } |
AhmedPlaymaker | 18:b391caa5754c | 1527 | if((length == 10)&&(b9 == 1)) { |
AhmedPlaymaker | 8:890b986b16a4 | 1528 | if (d == E) { |
AhmedPlaymaker | 8:890b986b16a4 | 1529 | _xi+= _speed; |
AhmedPlaymaker | 8:890b986b16a4 | 1530 | } |
AhmedPlaymaker | 8:890b986b16a4 | 1531 | if (d == W) { |
AhmedPlaymaker | 8:890b986b16a4 | 1532 | _xi-= _speed; |
AhmedPlaymaker | 8:890b986b16a4 | 1533 | } |
AhmedPlaymaker | 8:890b986b16a4 | 1534 | } |
AhmedPlaymaker | 18:b391caa5754c | 1535 | if((length == 9)&&(b8 == 1)) { |
AhmedPlaymaker | 8:890b986b16a4 | 1536 | if (d == E) { |
AhmedPlaymaker | 8:890b986b16a4 | 1537 | _xh+= _speed; |
AhmedPlaymaker | 8:890b986b16a4 | 1538 | } |
AhmedPlaymaker | 8:890b986b16a4 | 1539 | if (d == W) { |
AhmedPlaymaker | 8:890b986b16a4 | 1540 | _xh-= _speed; |
AhmedPlaymaker | 8:890b986b16a4 | 1541 | } |
AhmedPlaymaker | 7:48ba87cd79b5 | 1542 | } |
AhmedPlaymaker | 18:b391caa5754c | 1543 | if((length == 8)&&(b7 == 1)) { |
AhmedPlaymaker | 8:890b986b16a4 | 1544 | if (d == E) { |
AhmedPlaymaker | 8:890b986b16a4 | 1545 | _xg+= _speed; |
AhmedPlaymaker | 8:890b986b16a4 | 1546 | } |
AhmedPlaymaker | 8:890b986b16a4 | 1547 | if (d == W) { |
AhmedPlaymaker | 8:890b986b16a4 | 1548 | _xg-= _speed; |
AhmedPlaymaker | 8:890b986b16a4 | 1549 | } |
AhmedPlaymaker | 8:890b986b16a4 | 1550 | } |
AhmedPlaymaker | 18:b391caa5754c | 1551 | if((length == 7)&&(b6 == 1)) { |
AhmedPlaymaker | 8:890b986b16a4 | 1552 | if (d == E) { |
AhmedPlaymaker | 8:890b986b16a4 | 1553 | _xf+= _speed; |
AhmedPlaymaker | 8:890b986b16a4 | 1554 | } |
AhmedPlaymaker | 8:890b986b16a4 | 1555 | if (d == W) { |
AhmedPlaymaker | 8:890b986b16a4 | 1556 | _xf-= _speed; |
AhmedPlaymaker | 8:890b986b16a4 | 1557 | } |
AhmedPlaymaker | 8:890b986b16a4 | 1558 | } |
AhmedPlaymaker | 18:b391caa5754c | 1559 | if((length == 6)&&(b5 == 1)) { |
AhmedPlaymaker | 8:890b986b16a4 | 1560 | if (d == E) { |
AhmedPlaymaker | 8:890b986b16a4 | 1561 | _xe+= _speed; |
AhmedPlaymaker | 8:890b986b16a4 | 1562 | } |
AhmedPlaymaker | 8:890b986b16a4 | 1563 | if (d == W) { |
AhmedPlaymaker | 8:890b986b16a4 | 1564 | _xe-= _speed; |
AhmedPlaymaker | 8:890b986b16a4 | 1565 | } |
AhmedPlaymaker | 8:890b986b16a4 | 1566 | } |
AhmedPlaymaker | 18:b391caa5754c | 1567 | if((length == 5)&&(b4 == 1)) { |
AhmedPlaymaker | 8:890b986b16a4 | 1568 | if (d == E) { |
AhmedPlaymaker | 8:890b986b16a4 | 1569 | _xd+= _speed; |
AhmedPlaymaker | 8:890b986b16a4 | 1570 | } |
AhmedPlaymaker | 8:890b986b16a4 | 1571 | if (d == W) { |
AhmedPlaymaker | 8:890b986b16a4 | 1572 | _xd-= _speed; |
AhmedPlaymaker | 8:890b986b16a4 | 1573 | } |
AhmedPlaymaker | 8:890b986b16a4 | 1574 | } |
AhmedPlaymaker | 18:b391caa5754c | 1575 | if((length == 4)&&(b3 == 1)) { |
AhmedPlaymaker | 8:890b986b16a4 | 1576 | if (d == E) { |
AhmedPlaymaker | 8:890b986b16a4 | 1577 | _xc+= _speed; |
AhmedPlaymaker | 8:890b986b16a4 | 1578 | } |
AhmedPlaymaker | 8:890b986b16a4 | 1579 | if (d == W) { |
AhmedPlaymaker | 8:890b986b16a4 | 1580 | _xc-= _speed; |
AhmedPlaymaker | 8:890b986b16a4 | 1581 | } |
AhmedPlaymaker | 8:890b986b16a4 | 1582 | } |
AhmedPlaymaker | 18:b391caa5754c | 1583 | if((length == 3)&&(b2 == 1)) { |
AhmedPlaymaker | 8:890b986b16a4 | 1584 | if (d == E) { |
AhmedPlaymaker | 8:890b986b16a4 | 1585 | _xb+= _speed; |
AhmedPlaymaker | 8:890b986b16a4 | 1586 | } |
AhmedPlaymaker | 8:890b986b16a4 | 1587 | if (d == W) { |
AhmedPlaymaker | 8:890b986b16a4 | 1588 | _xb-= _speed; |
AhmedPlaymaker | 8:890b986b16a4 | 1589 | } |
AhmedPlaymaker | 8:890b986b16a4 | 1590 | } |
AhmedPlaymaker | 18:b391caa5754c | 1591 | if((length == 2)&&(b1 == 1)) { |
AhmedPlaymaker | 8:890b986b16a4 | 1592 | if (d == E) { |
AhmedPlaymaker | 8:890b986b16a4 | 1593 | _xa+= _speed; |
AhmedPlaymaker | 8:890b986b16a4 | 1594 | } |
AhmedPlaymaker | 8:890b986b16a4 | 1595 | if (d == W) { |
AhmedPlaymaker | 8:890b986b16a4 | 1596 | _xa-= _speed; |
AhmedPlaymaker | 8:890b986b16a4 | 1597 | } |
AhmedPlaymaker | 8:890b986b16a4 | 1598 | } |
AhmedPlaymaker | 18:b391caa5754c | 1599 | if((length == 1)&&(b0 == 1)) { |
AhmedPlaymaker | 8:890b986b16a4 | 1600 | if (d == E) { |
AhmedPlaymaker | 8:890b986b16a4 | 1601 | _x+= _speed; |
AhmedPlaymaker | 8:890b986b16a4 | 1602 | } |
AhmedPlaymaker | 8:890b986b16a4 | 1603 | if (d == W) { |
AhmedPlaymaker | 8:890b986b16a4 | 1604 | _x-= _speed; |
AhmedPlaymaker | 8:890b986b16a4 | 1605 | } |
AhmedPlaymaker | 7:48ba87cd79b5 | 1606 | } |
AhmedPlaymaker | 7:48ba87cd79b5 | 1607 | |
AhmedPlaymaker | 9:d1d79d4ee673 | 1608 | // the following makes sure that when the length is increased, the snake stays where it was when it ate food. |
AhmedPlaymaker | 7:48ba87cd79b5 | 1609 | |
AhmedPlaymaker | 9:d1d79d4ee673 | 1610 | if(length < 2) { |
AhmedPlaymaker | 9:d1d79d4ee673 | 1611 | _xa = _x; |
AhmedPlaymaker | 9:d1d79d4ee673 | 1612 | } |
AhmedPlaymaker | 9:d1d79d4ee673 | 1613 | else if(length < 3) { |
AhmedPlaymaker | 9:d1d79d4ee673 | 1614 | _xb = _xa; |
AhmedPlaymaker | 9:d1d79d4ee673 | 1615 | } |
AhmedPlaymaker | 9:d1d79d4ee673 | 1616 | else if(length < 4) { |
AhmedPlaymaker | 9:d1d79d4ee673 | 1617 | _xc = _xb; |
AhmedPlaymaker | 9:d1d79d4ee673 | 1618 | } |
AhmedPlaymaker | 9:d1d79d4ee673 | 1619 | else if(length < 5) { |
AhmedPlaymaker | 9:d1d79d4ee673 | 1620 | _xd = _xc; |
AhmedPlaymaker | 9:d1d79d4ee673 | 1621 | } |
AhmedPlaymaker | 9:d1d79d4ee673 | 1622 | else if(length < 6) { |
AhmedPlaymaker | 9:d1d79d4ee673 | 1623 | _xe = _xd; |
AhmedPlaymaker | 9:d1d79d4ee673 | 1624 | } |
AhmedPlaymaker | 9:d1d79d4ee673 | 1625 | else if(length < 7) { |
AhmedPlaymaker | 9:d1d79d4ee673 | 1626 | _xf = _xe; |
AhmedPlaymaker | 9:d1d79d4ee673 | 1627 | } |
AhmedPlaymaker | 9:d1d79d4ee673 | 1628 | else if(length < 8) { |
AhmedPlaymaker | 9:d1d79d4ee673 | 1629 | _xg = _xf; |
AhmedPlaymaker | 9:d1d79d4ee673 | 1630 | } |
AhmedPlaymaker | 9:d1d79d4ee673 | 1631 | else if(length < 9) { |
AhmedPlaymaker | 9:d1d79d4ee673 | 1632 | _xh = _xg; |
AhmedPlaymaker | 9:d1d79d4ee673 | 1633 | } |
AhmedPlaymaker | 9:d1d79d4ee673 | 1634 | else if(length < 10) { |
AhmedPlaymaker | 9:d1d79d4ee673 | 1635 | _xi = _xh; |
AhmedPlaymaker | 9:d1d79d4ee673 | 1636 | } |
AhmedPlaymaker | 18:b391caa5754c | 1637 | else if(length < 11) { |
AhmedPlaymaker | 9:d1d79d4ee673 | 1638 | _xj = _xi; |
AhmedPlaymaker | 9:d1d79d4ee673 | 1639 | } |
AhmedPlaymaker | 9:d1d79d4ee673 | 1640 | else if(length < 12) { |
AhmedPlaymaker | 9:d1d79d4ee673 | 1641 | _xk = _xj; |
AhmedPlaymaker | 9:d1d79d4ee673 | 1642 | } |
AhmedPlaymaker | 9:d1d79d4ee673 | 1643 | else if(length < 13) { |
AhmedPlaymaker | 9:d1d79d4ee673 | 1644 | _xl = _xk; |
AhmedPlaymaker | 9:d1d79d4ee673 | 1645 | } |
AhmedPlaymaker | 9:d1d79d4ee673 | 1646 | else if(length < 14) { |
AhmedPlaymaker | 9:d1d79d4ee673 | 1647 | _xm = _xl; |
AhmedPlaymaker | 9:d1d79d4ee673 | 1648 | } |
AhmedPlaymaker | 9:d1d79d4ee673 | 1649 | else if(length < 15) { |
AhmedPlaymaker | 9:d1d79d4ee673 | 1650 | _xn = _xm; |
AhmedPlaymaker | 9:d1d79d4ee673 | 1651 | } |
AhmedPlaymaker | 9:d1d79d4ee673 | 1652 | |
AhmedPlaymaker | 7:48ba87cd79b5 | 1653 | //Limits set so that the sprite does not travel off the screen. |
AhmedPlaymaker | 7:48ba87cd79b5 | 1654 | if (_y <= 0) { |
AhmedPlaymaker | 7:48ba87cd79b5 | 1655 | _y = 0; |
AhmedPlaymaker | 7:48ba87cd79b5 | 1656 | } |
AhmedPlaymaker | 7:48ba87cd79b5 | 1657 | if (_x <= 0) { |
AhmedPlaymaker | 7:48ba87cd79b5 | 1658 | _x = 0; |
AhmedPlaymaker | 7:48ba87cd79b5 | 1659 | } |
AhmedPlaymaker | 8:890b986b16a4 | 1660 | if (_xa <= 0) { |
AhmedPlaymaker | 8:890b986b16a4 | 1661 | _xa = 0; |
AhmedPlaymaker | 8:890b986b16a4 | 1662 | } |
AhmedPlaymaker | 8:890b986b16a4 | 1663 | if (_xb <= 0) { |
AhmedPlaymaker | 8:890b986b16a4 | 1664 | _xb = 0; |
AhmedPlaymaker | 8:890b986b16a4 | 1665 | } |
AhmedPlaymaker | 8:890b986b16a4 | 1666 | if (_xc <= 0) { |
AhmedPlaymaker | 8:890b986b16a4 | 1667 | _xc = 0; |
AhmedPlaymaker | 8:890b986b16a4 | 1668 | } |
AhmedPlaymaker | 8:890b986b16a4 | 1669 | if (_xd <= 0) { |
AhmedPlaymaker | 8:890b986b16a4 | 1670 | _xd = 0; |
AhmedPlaymaker | 8:890b986b16a4 | 1671 | } |
AhmedPlaymaker | 8:890b986b16a4 | 1672 | if (_xe <= 0) { |
AhmedPlaymaker | 8:890b986b16a4 | 1673 | _xe = 0; |
AhmedPlaymaker | 8:890b986b16a4 | 1674 | } |
AhmedPlaymaker | 8:890b986b16a4 | 1675 | if (_xf <= 0) { |
AhmedPlaymaker | 8:890b986b16a4 | 1676 | _xf = 0; |
AhmedPlaymaker | 8:890b986b16a4 | 1677 | } |
AhmedPlaymaker | 8:890b986b16a4 | 1678 | if (_xg <= 0) { |
AhmedPlaymaker | 8:890b986b16a4 | 1679 | _xg = 0; |
AhmedPlaymaker | 8:890b986b16a4 | 1680 | } |
AhmedPlaymaker | 8:890b986b16a4 | 1681 | if (_xh <= 0) { |
AhmedPlaymaker | 8:890b986b16a4 | 1682 | _xh = 0; |
AhmedPlaymaker | 8:890b986b16a4 | 1683 | } |
AhmedPlaymaker | 8:890b986b16a4 | 1684 | if (_xi <= 0) { |
AhmedPlaymaker | 8:890b986b16a4 | 1685 | _xi = 0; |
AhmedPlaymaker | 8:890b986b16a4 | 1686 | } |
AhmedPlaymaker | 8:890b986b16a4 | 1687 | if (_xj <= 0) { |
AhmedPlaymaker | 8:890b986b16a4 | 1688 | _xj = 0; |
AhmedPlaymaker | 8:890b986b16a4 | 1689 | } |
AhmedPlaymaker | 8:890b986b16a4 | 1690 | if (_xk <= 0) { |
AhmedPlaymaker | 8:890b986b16a4 | 1691 | _xk = 0; |
AhmedPlaymaker | 8:890b986b16a4 | 1692 | } |
AhmedPlaymaker | 8:890b986b16a4 | 1693 | if (_xl <= 0) { |
AhmedPlaymaker | 8:890b986b16a4 | 1694 | _xl = 0; |
AhmedPlaymaker | 8:890b986b16a4 | 1695 | } |
AhmedPlaymaker | 8:890b986b16a4 | 1696 | if (_xm <= 0) { |
AhmedPlaymaker | 8:890b986b16a4 | 1697 | _xm = 0; |
AhmedPlaymaker | 8:890b986b16a4 | 1698 | } |
AhmedPlaymaker | 8:890b986b16a4 | 1699 | if (_xn <= 0) { |
AhmedPlaymaker | 8:890b986b16a4 | 1700 | _xn = 0; |
AhmedPlaymaker | 7:48ba87cd79b5 | 1701 | } |
AhmedPlaymaker | 8:890b986b16a4 | 1702 | if (_x > 81) { |
AhmedPlaymaker | 8:890b986b16a4 | 1703 | _x = 81; |
AhmedPlaymaker | 8:890b986b16a4 | 1704 | } |
AhmedPlaymaker | 8:890b986b16a4 | 1705 | if (_xa > 81) { |
AhmedPlaymaker | 8:890b986b16a4 | 1706 | _xa = 81; |
AhmedPlaymaker | 8:890b986b16a4 | 1707 | } |
AhmedPlaymaker | 8:890b986b16a4 | 1708 | if (_xb > 81) { |
AhmedPlaymaker | 8:890b986b16a4 | 1709 | _xb = 81; |
AhmedPlaymaker | 8:890b986b16a4 | 1710 | } |
AhmedPlaymaker | 8:890b986b16a4 | 1711 | if (_xc > 81) { |
AhmedPlaymaker | 8:890b986b16a4 | 1712 | _xc = 81; |
AhmedPlaymaker | 8:890b986b16a4 | 1713 | } |
AhmedPlaymaker | 8:890b986b16a4 | 1714 | if (_xd > 81) { |
AhmedPlaymaker | 8:890b986b16a4 | 1715 | _xd = 81; |
AhmedPlaymaker | 8:890b986b16a4 | 1716 | } |
AhmedPlaymaker | 8:890b986b16a4 | 1717 | if (_xe > 81) { |
AhmedPlaymaker | 8:890b986b16a4 | 1718 | _xe = 81; |
AhmedPlaymaker | 8:890b986b16a4 | 1719 | } |
AhmedPlaymaker | 8:890b986b16a4 | 1720 | if (_xf > 81) { |
AhmedPlaymaker | 8:890b986b16a4 | 1721 | _xf = 81; |
AhmedPlaymaker | 7:48ba87cd79b5 | 1722 | } |
AhmedPlaymaker | 8:890b986b16a4 | 1723 | if (_xg > 81) { |
AhmedPlaymaker | 8:890b986b16a4 | 1724 | _xg = 81; |
AhmedPlaymaker | 8:890b986b16a4 | 1725 | } |
AhmedPlaymaker | 8:890b986b16a4 | 1726 | if (_xh > 81) { |
AhmedPlaymaker | 8:890b986b16a4 | 1727 | _xh = 81; |
AhmedPlaymaker | 8:890b986b16a4 | 1728 | } |
AhmedPlaymaker | 8:890b986b16a4 | 1729 | if (_xi > 81) { |
AhmedPlaymaker | 8:890b986b16a4 | 1730 | _xi = 81; |
AhmedPlaymaker | 8:890b986b16a4 | 1731 | } |
AhmedPlaymaker | 8:890b986b16a4 | 1732 | if (_xj > 81) { |
AhmedPlaymaker | 8:890b986b16a4 | 1733 | _xj = 81; |
AhmedPlaymaker | 8:890b986b16a4 | 1734 | } |
AhmedPlaymaker | 8:890b986b16a4 | 1735 | if (_xk > 81) { |
AhmedPlaymaker | 8:890b986b16a4 | 1736 | _xk = 81; |
AhmedPlaymaker | 8:890b986b16a4 | 1737 | } |
AhmedPlaymaker | 8:890b986b16a4 | 1738 | if (_xl > 81) { |
AhmedPlaymaker | 8:890b986b16a4 | 1739 | _xl = 81; |
AhmedPlaymaker | 8:890b986b16a4 | 1740 | } |
AhmedPlaymaker | 8:890b986b16a4 | 1741 | if (_xm > 81) { |
AhmedPlaymaker | 8:890b986b16a4 | 1742 | _xm = 81; |
AhmedPlaymaker | 8:890b986b16a4 | 1743 | } |
AhmedPlaymaker | 8:890b986b16a4 | 1744 | if (_xn > 81) { |
AhmedPlaymaker | 8:890b986b16a4 | 1745 | _xn = 81; |
AhmedPlaymaker | 8:890b986b16a4 | 1746 | } |
AhmedPlaymaker | 7:48ba87cd79b5 | 1747 | } |
AhmedPlaymaker | 7:48ba87cd79b5 | 1748 |