public void keyReleased(KeyEvent e) { // #if (mov_0) int key = e.getKeyCode(); if (key == KeyEvent.VK_LEFT) { current_Player.setLeft(false); } if (key == KeyEvent.VK_RIGHT) { current_Player.setRight(false); } if (key == KeyEvent.VK_DOWN) current_Player.setDown(false); if (key == KeyEvent.VK_UP) current_Player.setUp(false); if (key == KeyEvent.VK_SHIFT) current_Player.setSpeed(2); // #endif // #if (mov_1) // @ int key = e.getKeyCode(); // @ if (key == KeyEvent.VK_SPACE && current_Player.getLoad()==1) // current_Player.setLoad(2); // @ if (key == KeyEvent.VK_LEFT) current_Player.setLeft(false); // @ if (key == KeyEvent.VK_RIGHT) current_Player.setRight(false); // @ if (key == KeyEvent.VK_DOWN) current_Player.setDown(false); // @ if (key == KeyEvent.VK_UP) current_Player.setUp(false); // @ if (key == KeyEvent.VK_SHIFT) current_Player.setSpeed(2); // #endif // #if (mov_2) // @ int key = e.getKeyCode(); // @ if (key == KeyEvent.VK_LEFT) current_Player.setLeft(false); // @ if (key == KeyEvent.VK_RIGHT) current_Player.setRight(false); // @ if (key == KeyEvent.VK_DOWN) current_Player.setDown(false); // @ if (key == KeyEvent.VK_UP) current_Player.setUp(false); // @ if (key == KeyEvent.VK_SHIFT) current_Player.setSpeed(2); // #endif // #if (mov_3) // @ int key = e.getKeyCode(); // @ if (key == KeyEvent.VK_SPACE && // current_Player.getLoad()==1){current_Player.setLoad(2);} // @ if (key == KeyEvent.VK_LEFT) current_Player.setLeft(false); // @ if (key == KeyEvent.VK_RIGHT) current_Player.setRight(false); // @ if (key == KeyEvent.VK_DOWN) current_Player.setDown(false); // @ if (key == KeyEvent.VK_UP) current_Player.setUp(false); // @ if (key == KeyEvent.VK_SHIFT) current_Player.setSpeed(2); // #endif // #if (mov_4) // @ int key = e.getKeyCode(); // @ if (key == KeyEvent.VK_SPACE && current_Player.getLoad()==1) // current_Player.setLoad(2); // @ if (key == KeyEvent.VK_LEFT) current_Player.setLeft(false); // @ if (key == KeyEvent.VK_RIGHT) current_Player.setRight(false); // @ if (key == KeyEvent.VK_DOWN) current_Player.setDown(false); // @ if (key == KeyEvent.VK_UP) current_Player.setUp(false); // @ if (key == KeyEvent.VK_SHIFT) current_Player.setSpeed(2); // #endif }
public void checkEnvCollisions() { for (int i = 0; i < amountEnv; i++) { // #if (Hinderniss_Set) // @ if (env[i].getBounds().intersects(current_Player.getBounds())){ // @ current_Player.setCollision(true); // @ if (timecount == 0) timecount = 50; // @ } // @ //} // #else if (env[i].getBounds().intersects(current_Player.getBounds())) current_Player.setSpeed(1); // else current_Player.setSpeed(2); // #endif } }
public void checkPopupCollision() { for (int i = 0; i < 8; i++) { if (powerUps[i].isAktiv() && current_Player .getBounds() .intersects(powerUps[i].getX(), powerUps[i].getY(), 10, 10)) { powerUps[i].setAktiv(false); if (powerUps[i].getChange().equals("HP")) current_Player.setTp(current_Player.getTp() + powerUps[i].getChangeValue()); if (powerUps[i].getChange().equals("SP")) current_Player.setSpeed(powerUps[i].getChangeValue()); if (powerUps[i].getChange().equals("BP")) current_Player.setBp(current_Player.getBp() + powerUps[i].getChangeValue()); } } }
public void keyPressed(KeyEvent e) { // #if (mov_0) int key = e.getKeyCode(); if (key == KeyEvent.VK_LEFT) { current_Player.setLeft(true); } if (key == KeyEvent.VK_RIGHT) { current_Player.setRight(true); } if (key == KeyEvent.VK_DOWN) current_Player.setDown(true); if (key == KeyEvent.VK_UP) current_Player.setUp(true); if (key == KeyEvent.VK_SHIFT) current_Player.setSpeed(3); if (key == KeyEvent.VK_ENTER) if (current_Player.getSch().isIsActive() == false) changepl(); if (key == KeyEvent.VK_F1) ls.createNewPlayer(); // #if(tar) // @ if (key == KeyEvent.VK_Q){ // @ // current_Player.setRocket(true); // @ // sch = new Schuss((int)current_Player.getX(),(int)current_Player.getY()); // @ // current_Player.setBp(0); // @ } // #endif // #elif (mov_1) // @ int key = e.getKeyCode(); // @ if (key == KeyEvent.VK_LEFT){ // @ current_Player.setLeft(true); // @ } // @ if (key == KeyEvent.VK_RIGHT){ // @ current_Player.setRight(true); // @ } // @ if (key == KeyEvent.VK_SPACE && current_Player.getLoad() < 2){ // @ current_Player.setBp(current_Player.getBp()+5); // @ current_Player.setLoad(1); // @ } // @ if (key == KeyEvent.VK_DOWN) current_Player.setDown(true); // @ if (key == KeyEvent.VK_UP) current_Player.setUp(true); // @ if (key == KeyEvent.VK_SHIFT) current_Player.setSpeed(3); // @ if (key == KeyEvent.VK_ENTER) if (current_Player.getSch().isIsActive()==false) // changepl(); // @ if (key == KeyEvent.VK_F1) ls.createNewPlayer(); // #elif (mov_2) // @ int key = e.getKeyCode(); // @ if (key == KeyEvent.VK_LEFT) current_Player.setLeft(true); // @ if (key == KeyEvent.VK_RIGHT) current_Player.setRight(true); // @ if (key == KeyEvent.VK_DOWN) current_Player.setDown(true); // @ if (key == KeyEvent.VK_UP) current_Player.setUp(true); // @ if (key == KeyEvent.VK_SHIFT) current_Player.setSpeed(3); // @ if (key == KeyEvent.VK_ENTER) if (current_Player.getSch().isIsActive()==false) // changepl(); // @ if (key == KeyEvent.VK_F1) ls.createNewPlayer(); // #elif (mov_3) // @ int key = e.getKeyCode(); // @ if (key == KeyEvent.VK_LEFT){ // @ current_Player.setLeft(true); // @ } // @ if (key == KeyEvent.VK_RIGHT){ // @ current_Player.setRight(true); // @ } // @ if (key == KeyEvent.VK_SPACE){ // @ current_Player.setBp(current_Player.getBp()+5); // @ current_Player.setLoad(1); // @ //current_Player.setSpeed(5); // @ } // @ if (key == KeyEvent.VK_DOWN) current_Player.setDown(true); // @ if (key == KeyEvent.VK_UP) current_Player.setUp(true); // @ if (key == KeyEvent.VK_SHIFT) current_Player.setSpeed(3); // @ if (key == KeyEvent.VK_ENTER) if (current_Player.getSch().isIsActive()==false) // changepl(); // @ if (key == KeyEvent.VK_F1) ls.createNewPlayer(); // #elif (mov_4) // @ int key = e.getKeyCode(); // @ if (key == KeyEvent.VK_LEFT){ // @ current_Player.setLeft(true); // @ } // @ if (key == KeyEvent.VK_RIGHT){ // @ current_Player.setRight(true); // @ } // @ if (key == KeyEvent.VK_SPACE && current_Player.getLoad() < 2){ // @ current_Player.setBp(current_Player.getBp()+5); // @ current_Player.setLoad(1); // @ } // @ if (key == KeyEvent.VK_DOWN) current_Player.setDown(true); // @ if (key == KeyEvent.VK_UP) current_Player.setUp(true); // @ if (key == KeyEvent.VK_SHIFT) current_Player.setSpeed(3); // @ if (key == KeyEvent.VK_ENTER) if (current_Player.getSch().isIsActive()==false) // changepl(); // @ if (key == KeyEvent.VK_F1) ls.createNewPlayer(); // #endif // neu beginn if (key == KeyEvent.VK_Q) { // #if (tar) // @ current_Player.setRocket(true); // @ sch = new Schuss((int)current_Player.getX(),(int)current_Player.getY()); // @ current_Player.setBp(0); // #endif } // neu ende }