Example #1
0
 /**
  * Step forward once. This involves moving the images down by a speed and moving anything that
  * falls off the bottom back to the top.
  */
 public void step() {
   location0 += speed;
   location1 += speed;
   if (location0 > GameInformation.getHeight()) {
     location0 -= 2 * Assets.getImage(imageName).getHeight();
   }
   if (location1 > GameInformation.getHeight()) {
     location1 -= 2 * Assets.getImage(imageName).getHeight();
   }
 }
Example #2
0
 /**
  * Return the game title screen, in a dumb way following last Enterbrain conventions to avoid
  * numerous syscalls.
  */
 public static Bitmap getGameTitleScreen(GameInformation gameInformation) {
   // Search the title folder : the dumb way
   File dir = new File(gameInformation.getGameFolderPath() + "/Title");
   if (dir.isDirectory() && dir.canRead()) {
     File[] files = dir.listFiles();
     for (File f : files) {
       String name = f.getName().toLowerCase().trim();
       if (!f.getName().startsWith(".")
           && (name.endsWith("png") || name.endsWith("bmp") || name.endsWith("xyz"))) {
         Bitmap b = BitmapFactory.decodeFile(f.getAbsolutePath());
         if (b == null && GameBrowserActivity.libraryLoaded) {
           // Check for XYZ
           byte[] xyz = decodeXYZ(f.getAbsolutePath());
           if (xyz == null) {
             return null;
           }
           return BitmapFactory.decodeByteArray(xyz, 0, xyz.length);
         }
         return b;
       }
     }
   }
   return null;
 }