Technique to have screen independent grid based puzzle with sprite animation
- by Yan Cheng CHEOK
Hello all, let's say I have a fixed size grid puzzle game (8 x 10). I will be using sprites animation, when the "pieces" in the puzzle is moving from one grid to another grid.
I was wondering, what is the technique to have this game being implemented as screen resolution independent. Here is what I plan to do.
1) The data structure coordinate will be represented using double, with 1.0 as max value.
// Puzzle grid of 8 x 10
Environment {
double width = 0.8;
double height = 1.0;
}
// Location of Sprite at coordinate (1, 1)
Sprite {
double posX = 0.1;
double posY = 0.1;
double width = 0.1;
double height = 0.1;
}
// scale = PYSICAL_SCREEN_SIZE
drawBitmap (
sprite_image,
sprite_image_rect,
new Rect(sprite.posX * Scale, sprite.posY * Scale, (sprite.posX + sprite.width) * Scale, (sprite.posY + sprite.Height) * Scale),
paint
);
2) A large size sprite image will be used (128x128). As sprite image shall look fine if we scale from large size down to small size, but not vice versa.
Besides the above mentioned technique, is there any other consideration I had missed out?