What's wrong with my Processing? Sometimes works, sometimes does not work! (football / soccer)

edited January 2017 in Questions about Code

void setup() {
  size(500,500);
}

void draw() {
  background(0);
}

void keyPressed() {
  println(key);
}

This code sometimes gives me results in Console but most of the time gives me nothing. I don't understand. :|

Tagged:

Answers

  • edited January 2017

    Use keyCode instead:

    void draw() {
    }
    
    void keyPressed() {
      println(keyCode);
    }
    
  • Still not working properly.

  • Also I have this problem. After approx. 40 seconds my program "crash" like this:

  • ´Hello @kevo1414

    About your crash I guess your code would be pretty long to show here...

    void setup() {
      size(500,500);
    }
    
    void draw() {
      background(0);
    }
    
    void keyPressed() {
      println(keyCode);
    }
    
  • edited January 2017

    Guys can you help me and just compile this program a few times and wait for 40 seconds to see if it also crash on your's computers, because right now, I think that is someting wrong with my computer and that's what makes this sketch so ugly after 40 seconds or so.

    Thank you.

    EDIT: Yea, unfortunatly code is too long to post it here. Is there any other way to post it? I really need to fix this issue.

  • edited January 2017

    Yep someting is wrong with my laptop because on other computers works just fine without "crash". Still don't know what's wrong with my laptop though :-? My laptop works on Windows 8.1, might be this the reason?

  • i get an arrayindexoutofbounds error on line 165 after a while. trying to access value 65535 of a 128 element array.

    ah, ok, this happens when i alt-tab away from the screen. you need to check the key value before using it as an index (or delete the unused keys[] code)

Sign In or Register to comment.