Midterm Week 2

I created the magic 8 ball for this midterm project. When the user types a question and presses enter, the ball shakes for a certain amount of times and then an answer appears on the triangle. There is a yellow button that says “AGAIN” and when the user clicks it, the screen gets rested, the question and answer is gone.

In my original proposal, I stated that I will create the answers appear slowly like how they do in the real ones. I couldn’t figure out exactly how I can achieve this, so I made the answers immediately after the ball is shaken.
Speaking of that, shaking the ball for a certain amount of time was very difficult. Initially, the ball was being shaken the entire time the program was running, or it would not shake. I was able to fix this by creating a variable that counts how many times it was being shaken. This could be accomplished by creating a for loop, but for some reason when my program wouldn’t run with a for loop.

I had two classes in the code, one for the questions and the other for when the button is pressed. I created an array for the set of answers, which are given out randomly. The button is something I didn’t plan for, but I thought it was necessary for multiple questions.

If I can do things differently, I would add more set of answers. For this project I sticked to traditional answers that a normal magic 8 ball would have, but I think this can be super fun with different answers.

This is the link to my project:
https://www.openprocessing.org/sketch/516418