Added controls guide
This commit is contained in:
parent
1ecb4c7409
commit
d5f7d75e3d
24
sketch.js
24
sketch.js
@ -17,6 +17,7 @@ var audio = {};
|
|||||||
var sound_enabled = false;
|
var sound_enabled = false;
|
||||||
var music_enabled = false;
|
var music_enabled = false;
|
||||||
var game_state;
|
var game_state;
|
||||||
|
var show_guide;
|
||||||
|
|
||||||
var trees_x = [];
|
var trees_x = [];
|
||||||
var clouds = [];
|
var clouds = [];
|
||||||
@ -833,9 +834,30 @@ function complexDraw() {
|
|||||||
drawPlatforms(i);
|
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() {
|
function drawInterface() {
|
||||||
push();
|
push();
|
||||||
fill(0);
|
fill(0);
|
||||||
|
if (show_guide) showGuide();
|
||||||
text('Score: ' + game_score, 12, text_size);
|
text('Score: ' + game_score, 12, text_size);
|
||||||
textSize(text_size / 2);
|
textSize(text_size / 2);
|
||||||
if (music_enabled) phrase = 'enabled';
|
if (music_enabled) phrase = 'enabled';
|
||||||
@ -844,6 +866,7 @@ function drawInterface() {
|
|||||||
if (sound_enabled) phrase = 'enabled';
|
if (sound_enabled) phrase = 'enabled';
|
||||||
else phrase = 'disabled';
|
else phrase = 'disabled';
|
||||||
text('Sound - ' + phrase, 300, text_size);
|
text('Sound - ' + phrase, 300, text_size);
|
||||||
|
if (!show_guide) text('Q - Help', width - text_size*2, height - text_size/5);
|
||||||
textSize(text_size);
|
textSize(text_size);
|
||||||
stroke(255);
|
stroke(255);
|
||||||
strokeWeight(2);
|
strokeWeight(2);
|
||||||
@ -1251,6 +1274,7 @@ function keyPressed() {
|
|||||||
music_enabled = !music_enabled;
|
music_enabled = !music_enabled;
|
||||||
playMusic();
|
playMusic();
|
||||||
}
|
}
|
||||||
|
if (keyCode == 81 /*Q*/) show_guide = !show_guide;
|
||||||
}
|
}
|
||||||
function keyReleased() {
|
function keyReleased() {
|
||||||
if (keyCode == 65 /*A*/ || keyCode == LEFT_ARROW) gameChar.isLeft = false;
|
if (keyCode == 65 /*A*/ || keyCode == LEFT_ARROW) gameChar.isLeft = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user