diff --git a/sketch.js b/sketch.js index f67a4f3..dea645c 100644 --- a/sketch.js +++ b/sketch.js @@ -17,6 +17,7 @@ var audio = {}; var sound_enabled = false; var music_enabled = false; var game_state; +var show_guide; var trees_x = []; var clouds = []; @@ -833,9 +834,30 @@ function complexDraw() { drawPlatforms(i); } } +function showGuide() { + push(); + stroke(0); + strokeWeight(5); + fill('rgba(0,0,0,0.5)'); + rect(); + textSize(text_size/2); + rect(text_size, text_size*1.5, width - text_size*2, height - text_size*2); + fill(255); + noStroke(); + text("Press WASD or arrow buttons to move.", text_size*1.1, text_size*2); + text("Press Space to jump, too.", text_size*1.1, text_size*2.5); + text("Toggle music by P, toggle sounds by O.", text_size*1.1, text_size*3); + text("Jump onto same-colored platforms,", text_size*1.1, text_size*4); + text("and avoid enemial blobs of your current color.", text_size*1.1, text_size*4.5); + text("Go towards the finish, to the right. Have fun!", text_size*1.1, text_size*5); + fill('rgba(0,0,0,0.9)'); + text("Toggle shadows by N, toggle debug data by M", text_size*1.1, text_size*9.5); + pop(); +} function drawInterface() { push(); fill(0); + if (show_guide) showGuide(); text('Score: ' + game_score, 12, text_size); textSize(text_size / 2); if (music_enabled) phrase = 'enabled'; @@ -844,6 +866,7 @@ function drawInterface() { if (sound_enabled) phrase = 'enabled'; else phrase = 'disabled'; text('Sound - ' + phrase, 300, text_size); + if (!show_guide) text('Q - Help', width - text_size*2, height - text_size/5); textSize(text_size); stroke(255); strokeWeight(2); @@ -1251,6 +1274,7 @@ function keyPressed() { music_enabled = !music_enabled; playMusic(); } + if (keyCode == 81 /*Q*/) show_guide = !show_guide; } function keyReleased() { if (keyCode == 65 /*A*/ || keyCode == LEFT_ARROW) gameChar.isLeft = false;