Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 9th, 2012  |  syntax: None  |  size: 0.53 KB  |  hits: 23  |  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 Level(String ref){
  2.                 tiles = new SpriteSheet("res/rtiles.png", 2, 2);
  3.                 try{
  4.                         Scanner s = new Scanner(new File(ref));
  5.                         int width = s.nextInt();
  6.                         int height = s.nextInt();
  7.                         data = new int[width][height];
  8.                         terrain = new int[width][height];
  9.                         for(int y = 0; y < height; y++){
  10.                                 for(int x = 0; x < width; x++){
  11.                                         data[x][y] = s.nextInt();
  12.                                 }
  13.                         }
  14.                         for(int y = 0; y < height; y++){
  15.                                 for(int x = 0; x < width; x++){
  16.                                         terrain[x][y] = s.nextInt();
  17.                                 }
  18.                         }
  19.                 }catch(Exception e){
  20.                        
  21.                 }
  22.         }