mirror of
https://github.com/jokerx3/HeatUp
synced 2026-07-27 09:59:45 +02:00
ESC Key added for pause testing
This commit is contained in:
@@ -4,6 +4,7 @@ import java.awt.event.KeyAdapter;
|
||||
import java.awt.event.KeyEvent;
|
||||
|
||||
import de.heatup.mapengine.CollisionHandler;
|
||||
import de.heatup.testing.GameLoopD;
|
||||
import de.heatup.testing.Player;
|
||||
|
||||
public class KeyBindings extends KeyAdapter {
|
||||
@@ -12,6 +13,7 @@ public class KeyBindings extends KeyAdapter {
|
||||
private boolean right = false;
|
||||
private boolean up = false;
|
||||
private boolean down = false;
|
||||
private boolean esc = false;
|
||||
private Player player;
|
||||
|
||||
public KeyBindings(Player player) {
|
||||
@@ -34,6 +36,9 @@ public class KeyBindings extends KeyAdapter {
|
||||
case KeyEvent.VK_DOWN:
|
||||
down = false;
|
||||
break;
|
||||
case KeyEvent.VK_ESCAPE:
|
||||
esc = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,6 +58,9 @@ public class KeyBindings extends KeyAdapter {
|
||||
case KeyEvent.VK_DOWN:
|
||||
down = true;
|
||||
break;
|
||||
case KeyEvent.VK_ESCAPE:
|
||||
esc = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,6 +98,10 @@ public class KeyBindings extends KeyAdapter {
|
||||
}
|
||||
player.animate = true;
|
||||
}
|
||||
if (isESC()) {
|
||||
System.out.println("ESC pressed.");
|
||||
GameLoopD.pause();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isLeft() {
|
||||
@@ -107,4 +119,7 @@ public class KeyBindings extends KeyAdapter {
|
||||
public boolean isDown() {
|
||||
return down;
|
||||
}
|
||||
public boolean isESC() {
|
||||
return esc;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user