Following on from the processing tutorial earlier this week, I had a go at formulating the full structure for AdHac. I came across a few issues while building this…
Issue 1: User Feedback
The quiz structure I designed meant that the quiz would progress regardless of whether the user clicked Yes or No. To reduce the margin for error, it would be ideal to have the user select or ‘lock’ an answer, then click a separate button to proceed. I might add this in later, but for the time being I just decided to incorporate a simple underline as feedback to the user, so they can see which answer they selected.
Issue 2: keyPressed and keyReleased
Because I wanted the lines to show up around the answer before the quiz progressed to the next question, I separated the code that draws the line and the code that progressed the quiz to be triggered by keyPressed and keyReleased respectively. I knew that there must have been a better way to organise this. What if – for instance – I needed a sequence of more than two actions? Having already used keyPressed and keyReleased, there and no more trigger points for this single action. This didn’t pose a problem however until I tried to write keyReleased into void draw() and found that it didn’t work. I don’t know enough about processing to figure out how to make it work, so I rolled it back to the part of the code I knew could be written better. It wasn’t until I spoke to Spencer that I learned about Delay, which enables me to sequence one action after another as a result of one action by the user.
Issue 3: Chain Reaction
For a while, I thought this issue was related to the keyPressed/keyReleased issue, but after modifying that code and replacing it with delays. I found that my quiz was still falling through. The first two windows of the quiz are progressed by pressing 0, however I noticed that pressing 0 once progresses both windows in quick succession. I reworded the code as much as I could but could not get the quiz to stop at each new window. Again I sought the help of my tutor, and he suggested I use a switch with cases to break up the quiz into pieces. This worked, as it forces processing to stop at each new window, giving the user time to let go of the key and read the next question.