MCPcopy Create free account
hub / github.com/Code-Bullet/Jump-King / keyReleased

Function keyReleased

sketch.js:265–331  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

263
264
265function 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);

Callers 1

p5.jsFile · 0.50

Calls 2

JumpMethod · 0.80
cloneMethod · 0.45

Tested by

no test coverage detected