Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Aug 12th, 2012  |  syntax: Java  |  size: 1.19 KB  |  views: 7  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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.     }
clone this paste RAW Paste Data