I need to write a code on Khan Academy that lets me change images I have coded by pressing a key. To do this, I need to use keyTyped function, but I don't know how to make it work.
Also, I cannot use loops; I just need to write a function that lets me pick between different images by pressing a key. Below is a code of one image that I have.
//image: Kishin
var x = 180;
var y = 170;
var widthEllipse = 300;
var heightEllipse = 300;
var widthX = 80;
var heightY = 180;
background(94, 30, 30);
// bigger ellipse
fill(0, 0, 0);
ellipse(x + 20, y + 20, widthEllipse, heightEllipse);
//smaller ellipses
fill(148, 0, 0);
ellipse(130, 150, widthX - 50, heightY - 40);
ellipse(200, 230, widthX - 50, heightY - 40);
ellipse(270, 150, widthX - 50, heightY - 40);
// smallest ellipses
fill(0, 0, 0);
ellipse(130, 150, 30, 35);
ellipse(200, 230, 30, 35);
ellipse(270, 150, 30, 35);