class Board { // define variables int tilesX, tilesY, clickX, clickY; int bWidth, bHeight,tHeight,tWidth; int gameStartTime, gameStopTime, gameErrors; Tile[][] theTiles; float _tID = -1; // setting up tile ID number boolean tType = false; // zero is an image tile and one is a text tile boolean initialPick = false; boolean responseReceived; int primaryTileID=0; // this stores the information on clicked tiles int primaryTileX=0; int primaryTileY=0; int matchCount=0; boolean newGame = true; String scoreText ="", gameOverText =""; Board(int _tilesX, int _tilesY, int _bWidth, int _bHeight) { tilesX = _tilesX; tilesY = _tilesY; bWidth = _bWidth; bHeight = _bHeight; tHeight = bHeight/tilesY; tWidth = bWidth/tilesX; theTiles = new Tile[tilesX][tilesY]; } void render() { gameStartTime = millis(); newGame = false; gameErrors = 0; scoreText =""; gameOverText =""; /* if(applauseSound != null) { applauseSound.destroy(); } */ glassSound = new AudioChannel("glass.wav"); feile1Sound= new AudioChannel("feile1.wav"); float[] dbNums = new float[dbSize]; for(int i=0; i=tilesX*tilesY/2) { // if all of the tiles have been clicked gameStopTime = millis(); // record the time that game ended String gameTime; int gameLength = (gameStopTime-gameStartTime); // calculate length of game in milliseconds if (gameLength >= 20000) { gameTime = str(int(gameLength / 1000)); // round game length to no decimal places } else if (gameLength >= 10000) { gameTime = str(float(int(gameLength / 100))/10); // round game length to 1 decimal place } else { gameTime = str(float(int(gameLength / 10))/100); // round game length to 2 decimal places } theGame.score += constrain( 1000 - (gameLength/100) - (gameErrors * 30), 5, 1000); /////////HIGH SCORES DATA FILE MANAGEMENT\\\\\\\\\\ String[] scoreData = loadStrings("scores.csv"); // load the scores file String[][] scoreArray; scoreArray = new String[scoreData.length+1][3]; for(int i=0; i