SHARE
TWEET

Untitled

a guest Aug 12th, 2012 7 Never
  1. public void update(GameContainer gc, int delta)
  2.                         throws SlickException    
  3.     {
  4.         player.oldX = (int) player.locX;
  5.         player.oldY = (int) player.locY;
  6.         if (gc.getInput().isKeyDown(Input.KEY_LEFT) & gc.getInput().isKeyDown(Input.KEY_UP)) {player.move(Direction.UP_LEFT); return;}
  7.         if (gc.getInput().isKeyDown(Input.KEY_RIGHT) & gc.getInput().isKeyDown(Input.KEY_UP)) {player.move(Direction.UP_RIGHT); return;}
  8.         if (gc.getInput().isKeyDown(Input.KEY_LEFT) & gc.getInput().isKeyDown(Input.KEY_DOWN)) {player.move(Direction.DOWN_LEFT); return;}
  9.         if (gc.getInput().isKeyDown(Input.KEY_RIGHT) & gc.getInput().isKeyDown(Input.KEY_DOWN)) {player.move(Direction.DOWN_RIGHT); return;}
  10.        
  11.        
  12.         if (gc.getInput().isKeyDown(Input.KEY_LEFT)) {player.move(Direction.LEFT);return;}
  13.         if (gc.getInput().isKeyDown(Input.KEY_RIGHT)) {player.move(Direction.RIGHT);return;}
  14.         if (gc.getInput().isKeyDown(Input.KEY_UP)) {player.move(Direction.UP);return;}
  15.         if (gc.getInput().isKeyDown(Input.KEY_DOWN)) {player.move(Direction.DOWN);return;}
  16.        
  17.         if(player.collision()){
  18.                 player.locX = player.oldX;
  19.                 player.locY = player.oldY;
  20.         }
  21.         player.mapChange();
  22.     }
RAW Paste Data
Top