I want to add at least 8 obstacles in my game (2d like flappy bird but with different obstacles), should I load them manually:
sprite1 = pygame.image.load('assets/sprites/obstacle1.tif').convert_alpha()
sprite2 = pygame.image.load('assets/sprites/obstacle2.tif').convert_alpha()
sprite3 = pygame.image.load('assets/sprites/obstacle3.tif').convert_alpha()
...
Or perhaps something like:
type = "Obstacle 1" //example
public class Obstacle {
public Obstacle(String type,, int SizeX, int SizeY) {
ObstacleX = 1920;//spawn outside of screen
ObstacleType = type;
ObstacleSizeX = SizeX;
ObstacleSizeY = SizeY;
ObstacleImg = loadImage(ObstacleType + ".tif");
}
(not python but the idea is loading automatically sprites if they're on the database, checking every new frame the DB to see if there is an obstacle ready to spawn with the current map X )
PS: should I load them all in the begining of the game or load them weather they are currently passing the screen or not