Is it possible to change the origin point of a created actor?

tamercloud

  • Posts: 74
I'm wondering if there is a way to create an actor at position x,y, but use the center of the actor as the reference point, not the corner. How can I do this?

TDonnally

  • Posts: 235
There is probably a way but I could never figure it out, and never bothered asking.

I just add width or height of self divided by 2 to get the center. It is rough, but it works.

thegenericbanana

  • *
  • Posts: 494
Well, I don't use this, but you can change "x" to "x-center". Like, "create actor at x: (x-center) of self y: (y-center) of self.
Same block as setting the X. I probably just misread, as this is pretty obvious stuff, but might as well say it.
Johnny Turbo's Surgery Frenzy

froz

  • Posts: 250
If you want an actor you create to have a center at x,y, you need to create it at x minus half-width of that actor and y minus half-height of that actor. Since "width/height of self" blocks allow you to choose "half-width" etc. there is no need to manually divide it by 2.

So, what TDonnally set, except you need to diminish, not add half-width and half-height.

Eriko

  • Posts: 162
What about change it in the appereance tab of the actor?. Right where you tell Stencyl to loop the animation for that actor.

Stencyl Ninja

  • Posts: 245
One thing that I really liked about The Games Factory and other ClickTeam products was that you could set 2 different hotspots to wherever you wanted them with a nice visual interface.

I really wish that feature was in Stencyl too.

tamercloud

  • Posts: 74
Ah, I was hoping there was a cleaner way to do it, but I'll just stay with the suggested methods so far. I hope stencyl is willing to add such a useful feature in future updates.