Help with movement on a background

hello i am making a code for a character that moves on oa background but i keep having the following error
"Badly formed character constant(expecting quote, got E)

PImage bg, personagem;
int px, py;
boolean cima, baixo, esq, dir;

void setup(){
size(988,795);
bg = loadImage(“tela_velho.jpg”);
personagem = loadImage(“jogador.png”);

px = 500;
py= 500;

cima = baixo = dir = esq = false;

}

void draw(){
background(bg);
movejogador();

}

void movejogador(){
if(cima == true){
py -= 3;
}else{
if(baixo == true){
py += 3;
}
}
if(esq == true){
px -= 3;
}else{
if(dir == true){
px += 3;
}
}
image(personagem, px, py);
}

void keyPressed(){
if(key ==‘LEFT’){
esq = true;
}else{
if(key == ‘RIGHT’){
dir = true;
}else{
if(key == ‘DOWN’){
baixo = true;
}else{
if(key == ‘UP’){
cima = true;
}
}

Thanks in Advance

If i‘m not mistaken, then this is not possibile. You should set each Variable individually.

Correction: As jeremydouglass said below, it is actually valid code.

Actually, it is possible. Not always recommended, but valid code.

@somedude:

If you look at your error box, you will see that the error gives a line number: 40. If you click on the error message it will highlight the error line.

if (key =='LEFT') {

…you can’t put a String in single quotes in Java – it needs to be a char or Character, like ‘L’, or a String in double quotes like “LEFT”. But you don’t want either of those – you want the built-in PConstants keyword LEFT, which is a variable name and so doesn’t appear in quotes at all.

…AND you want to use it like this:

color fillVal = color(126);

void draw() {
  fill(fillVal);
  rect(25, 25, 50, 50);
}

void keyPressed() {
  if (key == CODED) {
    if (keyCode == LEFT) {
      fillVal = 255;
    } else if (keyCode == RIGHT) {
      fillVal = 0;
    } 
  } else {
    fillVal = 126;
  }
}