Cool! I look forward to seeing what you’ve made!
There are a couple of ways you might deal with translation and scaling in subpatterns.
First, it’s perfectly OK to call scale/translate/rotate in beforeRender(). You just have to call
resetTransform()
first, then do the new transforms you want. Like this:
export function beforeRender(delta) {
resetTransform();
translate(-0.5,-0.5);
scale(4,4);
....
(other code!)
}
The other thing to remember is that you can always do it yourself if you find it handier. Translate and scale in particular are just substitutes for adding and multiplying the x and y coordinates that you get in your render() function. So
scale(2,2);
is equivalent to adding the statements
x = 2 * x; y = 2 * y;
to render2D(), and
translate(-0.5,-0,5) ;
is equivalent to:
x = x-0.5; y = y-0.5;
(remember that order matters here – I usually follow “normal” practice and translate, then scale.)