logo

Crowdly

Browser

Add to Chrome

Given the following code, which letter should be pressed to move the circle to t...

✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.

Given the following code, which letter should be pressed to move the circle to the left, and how many times should it be pressed to place the circle at the centre of the canvas?

let x = 400;

function setup() {

  createCanvas(400, 400);

}

function draw() {

  background(0, 255, 255);

  fill(255, 0, 0);

  ellipse(x, 200, 50, 50);

}

function keyPressed() {

  if (key == "l") {

    x = x + 20;

  } else if (key == "j") {

    x = x - 20;

  }

}

0%
0%
0%
0%
More questions like this

Want instant access to all verified answers on elearning.aua.am?

Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!

Browser

Add to Chrome