Commit de7e2089 authored by Levi's avatar Levi
Browse files

fix: wrong value of keycode

parent eb44ec32
...@@ -66,7 +66,7 @@ public class Game extends Frame { ...@@ -66,7 +66,7 @@ public class Game extends Frame {
class BirdKeyListener implements KeyListener { class BirdKeyListener implements KeyListener {
// 按键按下,根据游戏当前的状态调用不同的方法 // 按键按下,根据游戏当前的状态调用不同的方法
public void keyPressed(KeyEvent e) { public void keyPressed(KeyEvent e) {
int keycode = e.getKeyChar(); int keycode = e.getKeyCode();
switch (gameState) { switch (gameState) {
case GAME_READY: case GAME_READY:
if (keycode == KeyEvent.VK_SPACE) { if (keycode == KeyEvent.VK_SPACE) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment