If the blocks / objects are independent of each other, I will continue to consider them as independent objects and update their position separately. In the end, you might want some of them to move differently from each other. In game development, itβs useful to leave the engine as flexible as possible, as long as you can - polishing a game includes many games and fine-tuning the mechanics of the game, and the more things you have to configure the more polished you can get it. Optimize only if necessary.
But if the blocks are not independent and will not, changing the viewing area, rather than moving each block, may be a good idea, although more information about your game will help - is it a platform? Shooter? If there is any object controlled by the player on the playing field, you will need to change its position in order to keep it on the screen when changing the viewing area, which can make things too complicated. It is hard to advise without any details.
Good question though!
EDIT:
After your comment, and I saw your other question Reducing the problem in Java with - = ' ; I think that I understand your question a little better - the main thing that I would change, from the point of view of design, would be the creation of blocks as needed, and not the creation of all of them at once. In other words, create blocks in the frame before they appear on the screen, and as soon as they exit the screen, delete them. Unless, of course, the design of the game does not require a large permanent world, but it does not look like such a game. Can the player step back or allow only one-way scrolling?
Bob montgomery
source share