draw = function() {

background(165, 219, 162);
fill(255, 254, 222);
rect(20, 100, 364, 200);

fill(0, 0, 0);
textSize(20);
text("What programming language is this?", 39, 200);
if (mouseIsPressed){
text("javascript",200,200);
} else{
text("What programming language is this?",200,200);
}
};
I want to have "JavaScript" displayed only when I press the mousepad. how do I do that

1 answer

To only display "JavaScript" when the mousepad is pressed, you need to modify the code inside the `draw` function. Here's an updated code:

```javascript
draw = function() {
background(165, 219, 162);
fill(255, 254, 222);
rect(20, 100, 364, 200);

fill(0, 0, 0);
textSize(20);
text("What programming language is this?", 39, 200);

if (mouseIsPressed) {
fill(0, 0, 0);
textSize(20);
text("JavaScript", 200, 200);
}
};
```

With this code, the text "JavaScript" will be displayed at the position (200, 200) only when the mousepad is pressed.
Similar Questions
  1. draw = function() {fill(0, 255, 68); // start color if (mouseIsPressed) { fill(33, 112, 52); // click color } rect(50, 150, 250,
    1. answers icon 1 answer
  2. draw = function() {fill(0, 255, 68); // start color if (mouseIsPressed&&mouseX>50&&mouseX>250&&mouseY<150&&mouseX<400) {
    1. answers icon 1 answer
  3. draw = function() {fill(0, 255, 68); // start color if (mouseIsPressed&&mouseX>50&&mouseX>250&&mouseY<150&&mouseX<400) {
    1. answers icon 1 answer
    1. answers icon 3 answers
more similar questions