| 263 | |
| 264 | |
| 265 | function keyReleased() { |
| 266 | |
| 267 | switch (key) { |
| 268 | case 'B': |
| 269 | replayingBestPlayer = true; |
| 270 | cloneOfBestPlayer = population.cloneOfBestPlayerFromPreviousGeneration.clone(); |
| 271 | evolationSpeed = 1; |
| 272 | mutePlayers = false; |
| 273 | break; |
| 274 | |
| 275 | |
| 276 | case ' ': |
| 277 | |
| 278 | if (!creatingLines) { |
| 279 | player.jumpHeld = false |
| 280 | player.Jump() |
| 281 | } |
| 282 | break; |
| 283 | case 'R': |
| 284 | if (creatingLines) { |
| 285 | lines = []; |
| 286 | linesString = ""; |
| 287 | mousePos1 = null; |
| 288 | mousePos2 = null; |
| 289 | } |
| 290 | break; |
| 291 | case 'N': |
| 292 | if (creatingLines) { |
| 293 | levelNumber += 1; |
| 294 | linesString += '\nlevels.push(tempLevel);'; |
| 295 | linesString += '\ntempLevel = new Level();'; |
| 296 | print(linesString); |
| 297 | lines = []; |
| 298 | linesString = ''; |
| 299 | mousePos1 = null; |
| 300 | mousePos2 = null; |
| 301 | } else { |
| 302 | player.currentLevelNo += 1; |
| 303 | print(player.currentLevelNo); |
| 304 | } |
| 305 | break; |
| 306 | case 'D': |
| 307 | if (creatingLines) { |
| 308 | |
| 309 | mousePos1 = null; |
| 310 | mousePos2 = null; |
| 311 | } |
| 312 | } |
| 313 | |
| 314 | switch (keyCode) { |
| 315 | case LEFT_ARROW: |
| 316 | player.leftHeld = false; |
| 317 | break; |
| 318 | case RIGHT_ARROW: |
| 319 | player.rightHeld = false; |
| 320 | break; |
| 321 | case DOWN_ARROW: |
| 322 | evolationSpeed = constrain(evolationSpeed - 1, 0, 50); |