I'm attempting to make a simple game of Pairs for Android.
Program Structure:
Menu.java (Menu activity initially loaded)
Game.java (Game activity, started by Menu)
GameThread.java (Handles gameloop, calls render process in GameView)
GameView.java (Handles all drawing to the screen)
Graphics.java (Stores loaded images)
The Problem:
The game features 15 different types of card, each of which requires around 14 frames for animation (flipping, destroying, etc). I'm currently reading these off a PNG spritesheet, and then chopping them into a Bitmap array (Bitmap[15][14]) using the following code:
for (int i=0; i<15; i++) {
for (int j=0; j<14; j++) {
card[i][j] = Bitmap.createBitmap(spriteSheet,
j*cardWidth, i*cardHeight, cardWidth, cardHeight);
}
}
The problem arises when I initially load the GameView, the card graphics need to be loaded, which seems to take around 2 seconds to process (resulting in an unresponsive app).
Is there a better way I can do this?
Thanks for your help in advance.