HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.6.0/p5.js"></script>
<script>
//is the game over?
var playing = false;
//speed at which the square will move
var speedx = 6;
var speedy = 4;
//setting square variables
var square = {
x: 300,
y: 200,
length: 80
};
//score
var score = 0;
//start + end background
var g = 120;
//start menu colour colChange
colChange = -3;
//transparency of buttons
var playfill = 0;
var sharefill = 0;
var settingsfill = 0;
var inButtonP = false;
function setup() {
createCanvas(600, 400);
}
function mousePressed() {
if (inButtonP) {
playing = true;
println("pressed");
}
}
function draw() {
//start screen
if (!(playing)) {
//background
background(221, g, 222);
//menu rectangle
stroke(255, 255, 255);
strokeWeight(5);
fill(0, 0, 0, 0);
rectMode(CENTER);
rect(300, 200, 500, 300, 50);
//menu text
textAlign(CENTER);
textSize(32);
text("THE WAITING GAME", 300, 120);
//play button
stroke(255, 255, 255);
strokeWeight(2);
fill(255, 255, 255, playfill);
rectMode(CENTER);
rect(300, 190, 360, 60);
textSize(20);
text("PLAY GAME", 300, 197);
//share button
stroke(255, 255, 255);
strokeWeight(2);
fill(255, 255, 255, sharefill);
rectMode(CENTER);
rect(205, 270, 170, 60);
strokeWeight(5);
fill(255, 255, 255);
ellipse(185, 260, 10, 10);
line(185, 260, 225, 270);
ellipse(225, 270, 10, 10);
line(225, 270, 185, 280);
ellipse(185, 280, 10, 10);
//settings button
stroke(255, 255, 255);
strokeWeight(2);
fill(255, 255, 255, settingsfill);
rectMode(CENTER);
rect(395, 270, 170, 60);
strokeWeight(5);
line(370, 260, 420, 260);
line(370, 270, 420, 270);
line(370, 280, 420, 280);
//colour...