////////////////////////////////////////////////////////// // Instructions for Extension: // - If you just want to add new elements to the existing game (the current elements being // the notes and the speed changes), just extend ScrollElement to create your new one, // and add it to the Staff's generateElement function. // - You could also start completely changing the colour of the game by extending Staff // and using completely new scrolling elements. You will probably be able to keep some // of the current Staff functions and override just a few, like generateElement and draw. // - Look for "HOOK" in the code. These aren't the only places you can override and change, // but will give you a good start. // NOTE: We're actually hoping you guys get really creative and completely change the game // using the same mechanics, just by changing the look and the elements. We're really // curious to see what you'll come up with! ////////////////////////////////////////////////////////// // HOOK: You can extend Staff and rename the type here Staff staff; PFont gameOverFont; void setup() { size(Config.gameWidth, Config.gameHeight); frameRate(Config.frameRate); staff = new Staff(); } void draw() { background(Config.backgroundColor); // if the points bar is empty then the game is over if (gameOver()) { gameOverFont = loadFont("Helvetica-20.vlw"); textFont(gameOverFont); textAlign(CENTER); text("Game Over\n\nPress space to restart", Config.gameWidth/2, Config.gameHeight/2); } else { if (!staff.advance()) { // we have reached the end of this staff // you could load a new one, or reload this one and double the speed, etc. } staff.draw(); } } boolean gameOver() { return staff.getPointsBar().empty(); } void restart() { staff.restart(); } void keyPressed() { if (gameOver()) { if (keyCode == 32) //space bar { restart(); } } else { staff.checkAndActKeyPress(key); } }