Coordinates don't update when actor is scaled

harryzun

  • *
  • Posts: 24
I'm working on a game with pixel art. To save space, I'm trying to import the actor animations at their original size and the scaling them up 9x.

Whenever I scale an actor, its X and Y coordinates never update, even though scaling moves the actor's top left corner. The coordinates are set somewhere inside the actor, where the top left corner of the 1x (unscaled) actor would have been. This affects positioning the actor in the scene, as well as drawing in the actor space (any action that involves the actor's coordinates).

Is this a bug? Or is this somehow the way it was intended to work? I can't imagine I am supposed to manually offset the coordinates for each actor I scale.

I've attached some screenshots and a log showing what happens when I try to draw something at (0 ,0) on a scaled actor.

LIBERADO

  • *
  • Posts: 2720
If your actor is scaled up 9x, you can use this to find its top left corner:
I'm spanish, excuse me for my bad English.
I'm not a private teacher. Please, post your questions in the public forum.

harryzun

  • *
  • Posts: 24
That's a step in the right direction, but I discovered that only works with actors with even dimensions. Because actors with odd dimensions cannot be divided in half evenly, Stencyl actually offsets the coordinates even more.

I'm writing an extension to address this in a clean way.  I'll post it here soon, but as an example, when a 9x scaled actor has an odd width AND height you use this:

« Last Edit: August 05, 2014, 09:23:36 pm by harryzun »

harryzun

  • *
  • Posts: 24
Alright, I put these fixes and much more into an extension. It's been heavily tested and will work for all scales, not just 9x!

Check it out here.

LIBERADO

  • *
  • Posts: 2720
I'm spanish, excuse me for my bad English.
I'm not a private teacher. Please, post your questions in the public forum.

harryzun

  • *
  • Posts: 24