Many 2D games are actually 3D with most objects fixed in certain planes (Unity 2D for example). If this were the case, you could quite literally just move the camera backwards as a quick fix. However, you mentioned processing!
Processing utilizes affine transformations, and has a built in transformation stack. It's hard for me to remember exactly what the function calls were to add or remove matrices from this stack.. I believe it was pushMatrix()
.
You're probably already using this transformation stack for things like camera movement (And if you aren't you absolutely should, read about affine transformations and translation matrices!!).
However, this pushMatrix()
function will add a given matrix to the transformation stack, and apply it to every object you draw as it is being drawn (Similar to the idea of OpenGL Shaders).
If you push a matrix to the stack that has scaling information on the diagonal with the rest of the entries as 0 for example:
0.1 0.0
0.0 0.1
Then it will effectively scale each block down to a tenth of the size. The generic matrix:
scaleX 0
0 scaleY
Now, if you are using the matrix stack already- you are going to want to make sure this matrix is pushed after to your translation matrices. Order of multiplication matters with matrices, and if you apply the scale then the translation, depending on how exactly the processing pipeline works under the hood you could potentially scale your translation too!
If you're curious- if memory serves I believe the transformations are done on the coordinate system of the objects being draw. So by scaling, I am scaling the axes which the object is being drawn on. And by translating, I am translating the origin of the axes. Same with rotation.
So in a nutshell using the processing API:
float scaleValue = 0.1f;
pushMatrix();
translate(-cameraX, -cameraY);
//Rotate(radians(90)); If you wanted rotation apply it after translation
scale(scaleValue);
rect(objectX, objectY, 100.0f, 100.0f); //ObjectX and objectY are
//object's position in worldspace
//Draw everything else you want effected by these transformations
popMatrix(); //Stop applying these transformations
For more information: https://processing.org/tutorials/transform2d/
As a quick aside, I would like to point out that processing does have you do it backwards than what the mathematics would suggest. You will usually want to apply Scale and rotation first followed by translation, mathematically speaking.