Undo change
parent
1a37787012
commit
8d7b62c065
|
@ -29,10 +29,22 @@ public class GenericSprite extends Rectangle{
|
||||||
//updates the direction of the ball based on user input
|
//updates the direction of the ball based on user input
|
||||||
//if the keyboard input isn't any of the options (d, a, w, s), then nothing happens
|
//if the keyboard input isn't any of the options (d, a, w, s), then nothing happens
|
||||||
public void keyPressed(KeyEvent e){
|
public void keyPressed(KeyEvent e){
|
||||||
rightPressed = e.getKeyChar() == 'd';
|
if(e.getKeyChar() == 'd'){
|
||||||
leftPressed = e.getKeyChar() == 'a';
|
rightPressed = true;
|
||||||
upPressed = e.getKeyChar() == 'w';
|
|
||||||
downPressed = e.getKeyChar() == 's';
|
}
|
||||||
|
if(e.getKeyChar() == 'a'){
|
||||||
|
leftPressed = true;
|
||||||
|
|
||||||
|
}
|
||||||
|
if(e.getKeyChar() == 'w'){
|
||||||
|
upPressed = true;
|
||||||
|
|
||||||
|
}
|
||||||
|
if(e.getKeyChar() == 's'){
|
||||||
|
downPressed = true;
|
||||||
|
|
||||||
|
}
|
||||||
move();
|
move();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue