Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>hey thanks for all the help i just solved it though.</p> <pre><code>public void keyPressed(KeyEvent e){ if(godDamn){ godDamn=false; int keyCode = e.getKeyCode(); if(keyCode == KeyEvent.VK_ESCAPE){ stop(); } if(keyCode == KeyEvent.VK_RIGHT){ player1.setVelocityX(0.3f); try{ t1.setRunning(true); Thread th1 = new Thread(t1); th1.start(); }catch(Exception ex){System.out.println("noooo");} } if(keyCode == KeyEvent.VK_LEFT){ player1.setVelocityX(-0.3f); try{ t1.setRunning(true); Thread th1 = new Thread(t1); th1.start(); }catch(Exception ex){System.out.println("noooo");} } if(keyCode == KeyEvent.VK_DOWN){ player1.setVelocityY(0.3f); try{ t1.setRunning(true); Thread th1 = new Thread(t1); th1.start(); }catch(Exception ex){System.out.println("noooo");} } if(keyCode == KeyEvent.VK_UP){ player1.setVelocityY(-0.3f); try{ t1.setRunning(true); Thread th1 = new Thread(t1);; th1.start(); }catch(Exception ex){System.out.println("noooo");} }else{ e.consume(); } } } //keyReleased @SuppressWarnings("static-access") public void keyReleased(KeyEvent e){ int keyCode = e.getKeyCode(); if(keyCode == KeyEvent.VK_RIGHT || keyCode == KeyEvent.VK_LEFT){ player1.setVelocityX(0); try{ this.t1.setRunning(false); }catch(Exception ex){} godDamn=true; } if(keyCode == KeyEvent.VK_UP || keyCode == KeyEvent.VK_DOWN){ player1.setVelocityY(0); try{ this.t1.setRunning(false); }catch(Exception ex){} }else{ e.consume(); } } </code></pre> <p>the new boolean stops the multiple key events from executing. i have to fine tune it but other wise i'm good.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload