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 java.awt.event.KeyEvent;
|
||||||
|
|
||||||
import de.heatup.mapengine.CollisionHandler;
|
import de.heatup.mapengine.CollisionHandler;
|
||||||
|
import de.heatup.testing.GameLoopD;
|
||||||
import de.heatup.testing.Player;
|
import de.heatup.testing.Player;
|
||||||
|
|
||||||
public class KeyBindings extends KeyAdapter {
|
public class KeyBindings extends KeyAdapter {
|
||||||
@@ -12,6 +13,7 @@ public class KeyBindings extends KeyAdapter {
|
|||||||
private boolean right = false;
|
private boolean right = false;
|
||||||
private boolean up = false;
|
private boolean up = false;
|
||||||
private boolean down = false;
|
private boolean down = false;
|
||||||
|
private boolean esc = false;
|
||||||
private Player player;
|
private Player player;
|
||||||
|
|
||||||
public KeyBindings(Player player) {
|
public KeyBindings(Player player) {
|
||||||
@@ -34,6 +36,9 @@ public class KeyBindings extends KeyAdapter {
|
|||||||
case KeyEvent.VK_DOWN:
|
case KeyEvent.VK_DOWN:
|
||||||
down = false;
|
down = false;
|
||||||
break;
|
break;
|
||||||
|
case KeyEvent.VK_ESCAPE:
|
||||||
|
esc = false;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53,6 +58,9 @@ public class KeyBindings extends KeyAdapter {
|
|||||||
case KeyEvent.VK_DOWN:
|
case KeyEvent.VK_DOWN:
|
||||||
down = true;
|
down = true;
|
||||||
break;
|
break;
|
||||||
|
case KeyEvent.VK_ESCAPE:
|
||||||
|
esc = true;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -90,6 +98,10 @@ public class KeyBindings extends KeyAdapter {
|
|||||||
}
|
}
|
||||||
player.animate = true;
|
player.animate = true;
|
||||||
}
|
}
|
||||||
|
if (isESC()) {
|
||||||
|
System.out.println("ESC pressed.");
|
||||||
|
GameLoopD.pause();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isLeft() {
|
public boolean isLeft() {
|
||||||
@@ -107,4 +119,7 @@ public class KeyBindings extends KeyAdapter {
|
|||||||
public boolean isDown() {
|
public boolean isDown() {
|
||||||
return down;
|
return down;
|
||||||
}
|
}
|
||||||
|
public boolean isESC() {
|
||||||
|
return esc;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user