I'm trying to make a simple interface with Processing to a game and i have some questions to make.
The game is something like "punch machine" so, the basics is writing the name of the player, save that in a text file (i suppose), And the score should also be saved in the file by the arduino when someone hits the sensor. and at the end, the name and the score must be shown on the interface, so the Processing needs to read that information from the file.
Here are the explanation and questions:
1 - I divided the game in four pieces. Each one is a Processing file. I'd like to introduce the game in the first screen, showing the name of the game and the sentence "PRESS ENTER TO START" or "CLICK TO START". I want to do ONE of the options I've just mentioned. When the player click on the screen OR press enter (or any button from keyboard), that action have to call the second piece of the game.
Question: Did I do on the right way? Can I split the game on pieces and call them on sequence as soon as i make some action like click with the mouse or press enter?? If it's possible, tell me how can i do that please!
2 - On the second piece of the game, the screen should ask for the player's name. So, it's needed to type his/her name FROM KEYBOARD and when I click in a button made with Processing on the screen OR hit ENTER, that name HAVE TO be written in a text file and at the same time, that action(click with the mouse on the screen OR hit enter), must call the third piece of the game.
Question: How can I do that?
3 - The player needs to hit the sensor which is linked to arduino. He/She has 5 seconds to hit it otherwise, his/her score is ZERO. I think I know how to put a chronometer. After the players hits the sensor, the interface HAVE TO call the last part of the game.
Question: How to call the last part of the game only depending on the player's hit?? How to save this score alongside the player's name? And the "score.txt" have to be ordened by the score and not by the name. I guess 10 players will play with the game, so processing needs to save theirs results individually, line by line in a text file.
4 - The last part of the game needs to show up ON THE PROCESSING INTERFACE SCREEN the result with the name and the score of the player. And also the name and score of the best player already written in the text file. So the processing needs to read from the file that 4 information and show: BEST PLAYER NAME, BEST PLAYER SCORE, CURRENT PLAYER SCORE and CURRENT PLAYER NAME.
Question: How can I do that? Is it possible?
Please, if you can help me, give me a CODE example telling how I can make that four steps with Processing as soon as possible. I really appreciate for that.