コード例 #1
0
 /**
  * first and second elements of the array are x and y Mario coordinates correspondingly
  *
  * @return an array of size 2*(number of creatures on screen) including mario
  */
 public float[] getCreaturesFloatPos() {
   float[] enemies = this.getEnemiesFloatPos();
   float ret[] = new float[enemies.length + 2];
   System.arraycopy(this.getMarioFloatPos(), 0, ret, 0, 2);
   System.arraycopy(enemies, 0, ret, 2, enemies.length);
   return ret;
 }
コード例 #2
0
 public LevelScene() {
   try {
     //            System.out.println("Java::LevelScene: loading tiles.dat...");
     //            System.out.println("LS: System.getProperty(\"user.dir()\") = " +
     // System.getProperty("user.dir"));
     Level.loadBehaviors(
         new DataInputStream(LevelScene.class.getResourceAsStream("resources/tiles.dat")));
   } catch (IOException e) {
     System.err.println(
         "[MarioAI ERROR] : error loading file resources/tiles.dat ; ensure this file exists in ch/idsia/benchmark/mario/engine ");
     e.printStackTrace();
     System.exit(0);
   }
 }