Use arrow keys or DFJK to click when a note is on the note clicker. Use "." to increase speed and "," to decrease speed
xxxxxxxxxx
// Note clicker position + size values
let NoteLeft = {
x:120, y:600, r:100, f: 'grey'
};
let NoteUp = {
x:240, y:600, r:100, f: 'grey'
};
let NoteDown = {
x:360, y:600, r:100, f: 'grey'
};
let NoteRight = {
x:480, y: 600, r: 100, f: 'grey'
};
let thefunnynote;
let notes = []
// Falling Notes position + size values
// let C1 = {x: 120,y: -50,r: 100}
// let CH1 = {x: 120,y: -50,r: 100}
// let C2 = {x: 240,y: -50,r: 100}
// let C3 = {x: 360,y: -50,r: 100}
// let C4 = {x: 480,y: -50,r: 100}
// player score
let score = 0;
// player misses
let misses = 0;
// speed of falling notes
let speed = 4;
// used for adding in a hold note (testing)
let mode = 0;
// false = player plays
// true = bot plays
let bot = false;
let transparency = 0;
// sets up canvas + background
function setup() {
createCanvas(600, 700);
// makes 4 falling notes when the game is loaded
for (let row = 0; row < 4; row ++) {
for (let col = 0; col < 1; col ++) {
let x = row * 120;
let y = col * 240;
notes.push(new Note(height/7,x + 120,y - 720,'yellow','GN'));
}
}
background(0);
}
// Checks for missed notes + adds in misses
// when falling notes pass the canvas
function checkMisses() {
let randomSpot = [120,240,360,480]
// Makes circles move down
for (let note of notes) {
note.fall();
if (note.y - note.r > height) {
//print(randomSpot[round(random(3))])
note.y = random(-20,-300);
misses += 1;
notes.push(new Note(height/7, randomSpot[round(random(3))], 0,'yellow','GN'));
}
}
}
// Allows player to use note clicker based on specific keys they press + can change note speed
// and enable botplay
function keyPressed() {
// controls
checkKeys();
for (let note of notes) {
if ((keyCode == LEFT_ARROW || keyCode == 68) && checkHit(NoteLeft,note)) {
note.y = random(-80, -1000)
score += 1
}
if ((keyCode == UP_ARROW || keyCode == 70) && checkHit(NoteUp,note)) {
note.y = random(-80,-1000)
score += 1
}
if ((keyCode == DOWN_ARROW || keyCode == 74) && checkHit(NoteDown,note)) {
note.y = random(-80,-1000)
score += 1
}
if ((keyCode == RIGHT_ARROW || keyCode == 75) && checkHit(NoteRight,note)) {
note.y = random(-80,-1000)
score += 1
}
}
if (keyCode == 32 && bot == false) {
bot = true
}
else if (keyCode == 32 && bot) {
bot = false
}
}
function checkKeys() {
// note speed
if (keyIsDown(190)) {
speed += 1
}
if (keyIsDown(188)) {
speed -= 1
if (speed <= 0) {
speed = 0
}
}
}
function showNotes() {
for (let note of notes) {
note.show();
}
}
// Draws + animates objects on the canvas
function draw() {
drawNotes()
showNotes();
//thefunnynote.show();
checkHoldNote()
botCheck()
//checkKeys()
checkMisses()
textAlign(CENTER,CENTER)
textSize(50)
fill(255,255,255,transparency)
noStroke()
textStyle(BOLD)
text('BOTPLAY',width/2,height/2)
}