3
\$\begingroup\$

I'm developing a simple 2d platformer using haxe & openfl (currently targeting flash). To achieve the old school pixelation effect I draw 16x16 sprites over a 4x scaled up canvas. With this approach character movement is very jerky since it seems to consist of a sequence of 4px jumps.

So my question is: how to be smooth & old school at the same time? Thank you for your time.

\$\endgroup\$
1
\$\begingroup\$

From what you're describing, you seem to be scaling a translation as well as your sprites. You should scale your sprites when you load them, then translate them around. Or, if you apply all your transformations at the same time, you must make sure that the translation is applied before the scaling.

Another option for you would be to scale them offline and load these instead. This would be at the loss of disk space.

\$\endgroup\$
3
  • \$\begingroup\$ Thank you, Alexandre. I set scaleX/Y to 4 once right after creating a new Bitmap canvasData = new BitmapData(w, h, false); canvas = new Bitmap(canvasData); canvas.scaleX = 4; canvas.scaleY = 4;. Is there a way to prevent translation from being scaled or I should use 64x64 sprites instead? \$\endgroup\$ – Finn Hill Mar 26 '15 at 12:58
  • \$\begingroup\$ I'm not familiar with your framework, but could it be that your your small sprites are children of your canvas? \$\endgroup\$ – Vaillancourt Mar 26 '15 at 14:35
  • \$\begingroup\$ @Alexandre Vaillancourt All Sprites are children in OpenFL's "main" Sprite: class Main extends openfl.display.Sprite {...} \$\endgroup\$ – madneon Mar 27 '15 at 12:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.