I'm pretty sure I should be using .setDrawOffset
as a way to pan the camera around a world. (If there's another way, let me know.)
The problem I have is with sprites that have a custom Sprite:draw
method. The draw offset affects them in their local coordinates too. I thought I could counteract that with pushContext
and setting the offset back to 0, 0 there, but that didn't work. If I set an image for the sprite it's fine though.
Am I missing something? Is there a way to counteract the offset locally in sprites?
Do I even care? I'm assuming for simple sprites (say, just a filled rect) its faster to just draw directly, instead of drawing into an image first. Maybe that's wrong.
In this image you can seem some squares that are clipped and not aligned with their collision rects after setting an offset: