mercredi 27 mars 2019

I have problems with If statement, and what to put inside of it

I will show you the challenge that I need to do. It's about if statement, and what to put inside of it. I have this chalenge:

In next section I will write you my code.

draw = function() {

fill(0, 255, 68); // start color
rect(0, 0, 400, 200);  // the button

// The button text
fill(0, 0, 0);
textSize(30);
text("Press me!", 145, 115);

};

The code is on the left side. On the right side is a rectangle with green background and text "Press me" . The chalengde is:

Buttons often change color when they're pressed, so that the user realizes they've pressed something. In this challenge, you'll change the code so that this button turns red when you press it. For this first step, add an if that colors the button red when you press the mouse anywhere on the canvas.

Aucun commentaire:

Enregistrer un commentaire