Problem with my collisions need help

-1- if you want check on the color of pixel
i think it should be not done in setup /only at beginning

-a- copy that 4 lines out of setup
-b- put it in a extra function

-c- and call that when moving.

-2- other thing:
the image calls in keypress better delete
as they are overwritten by draw.

void keyPressed() {
  if (key==CODED) {
    if ((keyCode==UP)   &&( q == b)) y = y-2; // notre Yoshi avance vers le haut
    if ((keyCode==DOWN) &&( r == b)) y = y+2; // notre Yoshi avance vers le bas
    if ((keyCode==LEFT) &&( s == b)) x = x-2; // notre Yoshi avance vers la gauche
    if ((keyCode==RIGHT)&&( t == b)) x = x+2; // notre Yoshi avance vers la droite
  }
  color_check();                              // for next move
}


void color_check() {    // called at setup and after every move
  q =get(x, y-5); //Color above Yoshi
  r= get(x, y+5); //Color under Yoshi
  s= get(x-5, y); //Color on the left of Yoshi
  t= get(x+5, y); //Color on the right of Yoshi  
}