Badly formed character constant

im programming a character that moves on a background with the arrow keys and im having an issue
i’ll leave the code on the description

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;
        }
      }
    }
  }
}

Hi someDude,

First, can you please format your code properly. You can read how to do it in this thread: Guidelines—Tips on Asking Questions

Then you say having an issue but you don’t explain what is the issue… I’m afraid nobody can help you like this.

Lastly, be careful when posting your code, I see that you are using an image in your program. If you want us to be able to run your code, you also need to provide all the resources needed to make it work.

i managed to fix it by adding a keyReleased.

Please don‘t Post questions multiple times.