var rY = 500;
var rX = 300;
var rW = 50;
var u = 200;
var u1 = 400;
var mod = 100;
function setup() {
createCanvas(600, 600);
}
function draw() {
background((rX+mod)/3,(rY+mod)/3,(rX+rY+mod)/3);
rectMode(CENTER);
noStroke();
fill("white");
rect(rX,rY,rW,rW);
if (keyIsPressed) {
if (key == 'w') {
rY = rY - 3;
}
if (key == 'a') {
rX = rX - 3;
}
if (key == 's') {
rY = rY + 3;
}
if (key == 'd') {
rX = rX + 3;
}
}
}
WASD to move