Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Levels.cpp
00001 #include "Levels.h" 00002 00003 Levels::Levels() 00004 { 00005 } 00006 00007 Levels::~Levels() 00008 { 00009 } 00010 /////////////////level 1 objects ///////////////////////// 00011 00012 // Generates all standard platforms for level 1 00013 void Levels::level_platforms1(N5110 &lcd) 00014 { 00015 lcd.drawLine(0,47,83,47, 1); 00016 lcd.drawRect(11,39, 38, 2, FILL_BLACK); 00017 lcd.drawRect(65,36, 30, 2, FILL_BLACK); 00018 lcd.drawRect(75,29, 9, 2, FILL_BLACK); 00019 lcd.drawRect(22, 25, 48, 2, FILL_BLACK); 00020 lcd.drawRect(0, 25, 12, 2, FILL_BLACK); 00021 lcd.drawRect(0, 17, 8, 2, FILL_BLACK); 00022 lcd.drawRect(0, 9, 27, 2, FILL_BLACK); 00023 lcd.drawRect(39, 9, 7, 2, FILL_BLACK); 00024 lcd.drawRect(53,9,32,2,FILL_BLACK); 00025 } 00026 00027 // sets positions of all traps level 1 00028 void Levels::trap_pos1() 00029 { 00030 trap1.tx[0] = 25; 00031 trap1.ty[0] = 44; 00032 trap2.tx[0] = 58; 00033 trap2.ty[0] = 6; 00034 trap3.tx[0] = 75; 00035 trap3.ty[0] = 6; 00036 trap4.tx[0] = 0; 00037 trap4.ty[0] = 0; 00038 trap5.tx[0] = 25; 00039 trap5.ty[0] = 36; 00040 } 00041 00042 // sets all key positions for keys 00043 void Levels::key_pos1() 00044 { 00045 key1.kx[0] = 79; 00046 key1.ky[0] = 12; 00047 key2.kx[0] = 36; 00048 key2.ky[0] = 22; 00049 key3.kx[0] = 40; 00050 key3.ky[0] = 6; 00051 key4.kx[0] = 62; 00052 key4.ky[0] = 6; 00053 key5.kx[0] = 75; 00054 key5.ky[0] = 0; 00055 } 00056 00057 // sets all block positions for level 1 00058 void Levels::block_pos1() 00059 { 00060 sol1.bx[0] = 49; 00061 sol1.by[0] = 36; 00062 00063 sol2.bx[0] = 42; 00064 sol2.by[0] = 22; 00065 00066 sol3.bx[0] = -10; 00067 sol3.by[0] = -10; 00068 00069 sol4.bx[0] = -10; 00070 sol4.by[0] = -10; 00071 00072 sol5.bx[0] = -10; 00073 sol5.by[0] = -10; 00074 } 00075 00076 // sets all sinking block positions for level 1 00077 void Levels::soft_pos1() 00078 { 00079 sof1.sx1[0] = 55; 00080 sof1.sy[0] = 36; 00081 sof1.sx2[0] = 65; 00082 00083 sof2.sx1[0] = 27; 00084 sof2.sy[0] = 9; 00085 sof2.sx2[0] = 39; 00086 00087 sof3.sx1[0] = 46; 00088 sof3.sy[0] = 9; 00089 sof3.sx2[0] = 52; 00090 00091 } 00092 00093 // sets all enemy positions for level 1 00094 void Levels::enem_pos1() 00095 { 00096 enem1.ex[0] = 22; 00097 enem1.ey[0] = 20; 00098 enem1.d[0] = 36; 00099 enem1.v[0] = 0.5; 00100 00101 enem2.ex[0] = 0; 00102 enem2.ey[0] = 4; 00103 enem2.d[0] = 26; 00104 enem2.v[0] = 1; 00105 00106 enem3.ex[0] = 49; 00107 enem3.ey[0] = 42; 00108 enem3.d[0] = 27; 00109 enem3.v[0] = 1; 00110 } 00111 00112 /////////////////level 2 objects ///////////////////////// 00113 00114 // platform positions for level 2 00115 void Levels::level_platforms2(N5110 &lcd) 00116 { 00117 lcd.drawLine(0, 47, 83, 47, 1); 00118 lcd.drawRect(4, 33, 12, 2, FILL_BLACK); 00119 lcd.drawRect(20, 41, 12, 2, FILL_BLACK); 00120 lcd.drawRect(36, 37, 12, 2, FILL_BLACK); 00121 lcd.drawRect(48, 29, 12, 2, FILL_BLACK); 00122 lcd.drawRect(24, 21, 24, 2, FILL_BLACK); 00123 lcd.drawRect(20, 10, 29, 2, FILL_BLACK); 00124 lcd.drawRect(54, 14, 12, 2, FILL_BLACK); 00125 lcd.drawRect(0, 10, 10, 2, FILL_BLACK); 00126 } 00127 00128 // key positions for level 2 00129 void Levels::key_pos2() 00130 { 00131 key1.kx[1] = 55; 00132 key1.ky[1] = 44; 00133 00134 key2.kx[1] = 79; 00135 key2.ky[1] = 29; 00136 00137 key3.kx[1] = 72; 00138 key3.ky[1] = 23; 00139 00140 key4.kx[1] = 24; 00141 key4.ky[1] = 0; 00142 00143 key5.kx[1] = 1; 00144 key5.ky[1] = 7; 00145 } 00146 00147 // trap positions for level 2 00148 void Levels::trap_pos2() 00149 { 00150 trap1.tx[1] = 30; 00151 trap1.ty[1] = 7; 00152 00153 trap2.tx[1] = 72; 00154 trap2.ty[1] = 17; 00155 00156 trap3.tx[1] = 51; 00157 trap3.ty[1] = 44; 00158 00159 trap4.tx[1] = 42; 00160 trap4.ty[1] = 7; 00161 00162 trap5.tx[1] = 80; 00163 trap5.ty[1] = 35; 00164 } 00165 00166 // enemy positions for level 2 00167 void Levels::enem_pos2() 00168 { 00169 enem1.ex[1] = 24; 00170 enem1.ey[1] = 16; 00171 enem1.d[1] = 44; 00172 enem1.v[1] = 0.5; 00173 00174 enem2.ex[1] = 20; 00175 enem2.ey[1] = 5; 00176 enem2.d[1] = 27; 00177 enem2.v[1] = 1; 00178 00179 enem3.ex[1] = 54; 00180 enem3.ey[1] = 42; 00181 enem3.d[1] = 30; 00182 enem3.v[1] = 1; 00183 } 00184 00185 // block positions for level 2 00186 void Levels::block_pos2() 00187 { 00188 sol1.bx[1] = 66; 00189 sol1.by[1] = 38; 00190 00191 sol2.bx[1] = 66; 00192 sol2.by[1] = 32; 00193 00194 sol3.bx[1] = 66; 00195 sol3.by[1] = 26; 00196 00197 sol4.bx[1] = 66; 00198 sol4.by[1] = 20; 00199 00200 sol5.bx[1] = 66; 00201 sol5.by[1] = 14; 00202 } 00203 00204 // sinking block positions for level 2 00205 void Levels::soft_pos2() 00206 { 00207 sof1.sx1[1] = 72; 00208 sof1.sy[1] = 38; 00209 sof1.sx2[1] = 84; 00210 00211 sof2.sx1[1] = 72; 00212 sof2.sy[1] = 32; 00213 sof2.sx2[1] = 84; 00214 00215 sof3.sx1[1] = 72; 00216 sof3.sy[1] = 26; 00217 sof3.sx2[1] = 84; 00218 00219 sof4.sx1[1] = 72; 00220 sof4.sy[1] = 20; 00221 sof4.sx2[1] = 84; 00222 00223 sof5.sx1[1] = 72; 00224 sof5.sy[1] = 14; 00225 sof5.sx2[1] = 84; 00226 } 00227 00228 /////////////////level 3 objects ///////////////////////// 00229 00230 // platform positions for level 3 00231 void Levels::level_platforms3(N5110 &lcd) 00232 { 00233 lcd.drawLine(0, 47, 83, 47, 1); 00234 lcd.drawRect(36, 31, 6, 2, FILL_BLACK); 00235 lcd.drawRect(30, 10, 42, 2, FILL_BLACK); 00236 lcd.drawRect(78, 20, 6, 2, FILL_BLACK); 00237 lcd.drawRect(66, 26, 10, 2, FILL_BLACK); 00238 lcd.drawRect(54, 30, 10, 2, FILL_BLACK); 00239 00240 } 00241 00242 // key positions for level 3 00243 void Levels::key_pos3() 00244 { 00245 key1.kx[2] = 38; 00246 key1.ky[2] = 7; 00247 00248 key2.kx[2] = 66; 00249 key2.ky[2] = 7; 00250 00251 key3.kx[2] = 0; 00252 key3.ky[2] = 5; 00253 00254 key4.kx[2] = 57; 00255 key4.ky[2] = 27; 00256 00257 key5.kx[2] = 69; 00258 key5.ky[2] = 23; 00259 } 00260 00261 // trap positions for level 3 00262 void Levels::trap_pos3() 00263 { 00264 trap1.tx[2] = 54; 00265 trap1.ty[2] = 27; 00266 00267 trap2.tx[2] = 66; 00268 trap2.ty[2] = 23; 00269 00270 trap3.tx[2] = 61; 00271 trap3.ty[2] = 27; 00272 00273 trap4.tx[2] = 73; 00274 trap4.ty[2] = 23; 00275 00276 trap5.tx[2] = 52; 00277 trap5.ty[2] = 7; 00278 } 00279 00280 // enemy positions for level 3 00281 void Levels::enem_pos3() 00282 { 00283 enem1.ex[2] = 49; 00284 enem1.ey[2] = 5; 00285 enem1.d[2] = 33; 00286 enem1.v[2] = 1; 00287 00288 enem2.ex[2] = 30; 00289 enem2.ey[2] = 5; 00290 enem2.d[2] = 42; 00291 enem2.v[2] = 1.25; 00292 00293 enem3.ex[2] = 35; 00294 enem3.ey[2] = 5; 00295 enem3.d[2] = 20; 00296 enem3.v[2] = 1; 00297 } 00298 00299 // block positions for level 3 00300 void Levels::block_pos3() 00301 { 00302 sol1.bx[2] = 15; 00303 sol1.by[2] = 39; 00304 00305 sol2.bx[2] = 30; 00306 sol2.by[2] = 31; 00307 00308 sol3.bx[2] = 15; 00309 sol3.by[2] = 23; 00310 00311 sol4.bx[2] = 0; 00312 sol4.by[2] = 8; 00313 00314 sol5.bx[2] = 0; 00315 sol5.by[2] = 16; 00316 } 00317 00318 // sinking block positions for level 3 00319 void Levels::soft_pos3() 00320 { 00321 sof1.sx1[2] = 12; 00322 sof1.sy[2] = 16; 00323 sof1.sx2[2] = 24; 00324 00325 sof2.sx1[2] = 72; 00326 sof2.sy[2] = 10; 00327 sof2.sx2[2] = 84; 00328 00329 } 00330 00331 /////////////////level 4 objects ///////////////////////// 00332 00333 void Levels::level_platforms4(N5110 &lcd) 00334 { 00335 lcd.drawLine(0, 47, 83, 47, 1); 00336 lcd.drawRect(36, 31, 6, 2, FILL_BLACK); 00337 lcd.drawRect(30, 10, 42, 2, FILL_BLACK); 00338 lcd.drawRect(78, 20, 6, 2, FILL_BLACK); 00339 lcd.drawRect(66, 26, 10, 2, FILL_BLACK); 00340 lcd.drawRect(54, 30, 10, 2, FILL_BLACK); 00341 00342 } 00343 00344 // key positions for level 4 00345 void Levels::key_pos4() 00346 { 00347 key1.kx[3] = 38; 00348 key1.ky[3] = 7; 00349 00350 key2.kx[3] = 66; 00351 key2.ky[3] = 7; 00352 00353 key3.kx[3] = 0; 00354 key3.ky[3] = 5; 00355 00356 key4.kx[3] = 57; 00357 key4.ky[3] = 27; 00358 00359 key5.kx[3] = 69; 00360 key5.ky[3] = 23; 00361 } 00362 00363 // trap positions for level 4 00364 void Levels::trap_pos4() 00365 { 00366 trap1.tx[3] = 54; 00367 trap1.ty[3] = 27; 00368 00369 trap2.tx[3] = 66; 00370 trap2.ty[3] = 23; 00371 00372 trap3.tx[3] = 61; 00373 trap3.ty[3] = 27; 00374 00375 trap4.tx[3] = 73; 00376 trap4.ty[3] = 23; 00377 00378 trap5.tx[3] = 52; 00379 trap5.ty[3] = 7; 00380 } 00381 00382 // enemy positions for level 4 00383 void Levels::enem_pos4() 00384 { 00385 enem1.ex[3] = 49; 00386 enem1.ey[3] = 5; 00387 enem1.d[3] = 33; 00388 enem1.v[3] = 1; 00389 00390 enem2.ex[3] = 30; 00391 enem2.ey[3] = 5; 00392 enem2.d[3] = 42; 00393 enem2.v[3] = 1.25; 00394 00395 enem3.ex[3] = 35; 00396 enem3.ey[3] = 5; 00397 enem3.d[3] = 20; 00398 enem3.v[3] = 1; 00399 } 00400 00401 // block positions for level 4 00402 void Levels::block_pos4() 00403 { 00404 sol1.bx[3] = 15; 00405 sol1.by[3] = 39; 00406 00407 sol2.bx[3] = 30; 00408 sol2.by[3] = 31; 00409 00410 sol3.bx[3] = 15; 00411 sol3.by[3] = 23; 00412 00413 sol4.bx[3] = 0; 00414 sol4.by[3] = 8; 00415 00416 sol5.bx[3] = 0; 00417 sol5.by[3] = 16; 00418 } 00419 00420 // sinking block positions for level 4 00421 void Levels::soft_pos4() 00422 { 00423 sof1.sx1[3] = 12; 00424 sof1.sy[3] = 16; 00425 sof1.sx2[3] = 24; 00426 00427 sof2.sx1[3] = 72; 00428 sof2.sy[3] = 10; 00429 sof2.sx2[3] = 84; 00430 }
Generated on Wed Jul 13 2022 01:25:32 by
1.7.2