Creating Snake Code

Can you say what problem? What are you expecting to happen? What happens instead? How do you know this is the code where it goes wrong (we can’t test it on its own without a full sketch)

When I add this to your keypressed above:

void draw(){}
void setDirection(char c){
  println(c);
}

…it seems to work just fine for me.

Note that to register keypresses, your focus must be inside the sketch window.

1 Like