Quantcast
Channel: Library Questions - Processing 2.x and 3.x Forum
Viewing all articles
Browse latest Browse all 2896

Quote generator problem

$
0
0

Hi all! So, I'm new to Processing and am trying to make a quote generator based on the musical 'Hamilton' for a college project. Basically, what this should be is when the button is pressed, a quote appears in the box with the accompanying sound file. I've got some of the code done, with one quote for testing, but when I press the button, the text is behind the box and only appears for a moment. Here's the relevant code:

void drawButton()
{
  fill(210, 201, 0);
  ellipse(buttonCentX, buttonCentY, buttonBottomWidth, buttonBottomHeight);
  fill(75);
  ellipse(buttonCentX, buttonCentY, buttonWidth, buttonHeight);
}
boolean buttonPressed;
void buttonFunc()
{
  if (mousePressed)
  {
    if (mouseX>=buttonCentX-buttonWidth && mouseX<=buttonCentX+buttonWidth &&
    mouseY>=buttonCentY-buttonWidth && mouseY<=buttonCentY+buttonWidth)
    {
      buttonPressed = true;
      if (buttonPressed = true)
      {
    fill(10);
    ellipse(buttonCentX, buttonCentY, buttonWidth, buttonHeight);
    player_1.play();
    textSize(14);
    text("I am inimitable, I am an original", 130,430);
    }
  }
}
}

If anyone could help, that would be greatly appreciated! Thank you!


Viewing all articles
Browse latest Browse all 2896

Trending Articles