Let's say I want to make a 2D game and I'll use a spritesheet containing all of the animation frames and a texture-atlas for static sprites such as walls, non-animated decorations...etc.
Should I create separate image objects for all the static sprites and for all animation-rows or should I just pass the on-texture-atlas (or on-spritesheet) coordinates for them?
Which solution, or "direction" is considered elegant in game-development?
Thanks for the help! :)
Some pseudocode:
Separate image objects:
Class StaticSprite {
Image texture;
// ...
public Image getImage() {
// ...
}
public static final CheckedWall cw = new CheckedWall( -- checked wall grid extracted from the texture-atlas -- )
public static final WoodWall ww = new WoodWall( -- wood wall grid extracted from the texture...
}
Or:
class StaticSprite {
int texX, texY, size;
// ...
public Image getImage() {
// gives the part of the spritesheet
}
public static final WoodWall ww = new WoodWall( -- coordinates for the texture-atlas -- )
}
Assuming that the spritesheet is accessible for all these sprite-related classes.