erreur
This commit is contained in:
parent
e2bd00963a
commit
65ef4b0991
@ -1,33 +0,0 @@
|
||||
package Controller;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.event.KeyListener;
|
||||
|
||||
public class HGameController implements KeyListener {
|
||||
private Player player;
|
||||
|
||||
public HGameController(Player player) {
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void keyPressed(KeyEvent e) {
|
||||
int keyCode = e.getKeyCode();
|
||||
if (keyCode == KeyEvent.VK_UP) {
|
||||
player.move(-1, 0);
|
||||
} else if (keyCode == KeyEvent.VK_DOWN) {
|
||||
player.move(1, 0);
|
||||
} else if (keyCode == KeyEvent.VK_LEFT) {
|
||||
player.move(0, -1);
|
||||
} else if (keyCode == KeyEvent.VK_RIGHT) {
|
||||
player.move(0, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void keyReleased(KeyEvent e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void keyTyped(KeyEvent e) {
|
||||
}
|
||||
}
|
23
Player.java
23
Player.java
@ -1,23 +0,0 @@
|
||||
package Controller;
|
||||
public class Player {
|
||||
private int x;
|
||||
private int y;
|
||||
|
||||
public Player(int x, int y) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
public void move(int dx, int dy) {
|
||||
x += dx;
|
||||
y += dy;
|
||||
}
|
||||
|
||||
public int getX() {
|
||||
return x;
|
||||
}
|
||||
|
||||
public int getY() {
|
||||
return y;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user