[Solved]Tiled sprites, Origin point

Is it possible to change the origin point at Tiled sprite? For example, from left upper corner to the center point of it.

Mmm… I don’t think so, seem you’ll have to do some math :neutral_face:

I̶t̶ ̶i̶s̶ ̶p̶o̶s̶s̶i̶b̶l̶e̶ ̶t̶o̶ ̶c̶h̶a̶n̶g̶e̶ ̶t̶h̶e̶ ̶o̶r̶i̶g̶i̶n̶ ̶p̶o̶i̶n̶t̶ ̶o̶f̶ ̶a̶ ̶t̶i̶l̶e̶d̶ ̶s̶p̶r̶i̶t̶e̶ ̶(̶m̶o̶s̶a̶i̶c̶)̶ ̶o̶b̶j̶e̶c̶t̶,̶ ̶y̶e̶s̶.̶

B̶u̶t̶ it’s not possible to set the origin point of the tiled picture into the mosaic object.

Is that what you mean?

So, how to do it? :slight_smile:

I don’t think you can change it.
What do you want to do exactly ?

Uhmmm, nope, sorry… I was thinking wrong… it seems it’s not possible.


But you can do this:

  • Make a function an call it sometthing like move_mosaic or whatever…
  • You have to pass two parameters to the function: one for the X value and another for the Y value (this values will be the “centered origin”)
  • Now, the function has to move the mosaic object to a position calculated by this simple formulas:

X = parameter_X - (mosaic_object.Width/2) Y = parameter_Y - (mosaic_object.Height/2)

Where:
mosaic_object is the name of your mosaic object
X is the actual horizontal position of your mosaic object.
Y is the actual vertical position of your mosaic object.
parameter_X is the parameter passed to the function as the centered-origin horizontal position.
parameter_Y is the parameter passed to the function as the centered-origin vertical position.

Every time you want to move your mosaic object by its “centered origin” you just have to call this function and pass two coordenates.

This function can be adapted to work with other “non-centered origins”.

Here is the example project:
centered_origin_in_mosaic_object.zip (4.52 KB)

Good luck! :wink:

Thanks for replies and the example - will use it in the topic “Tips for Beginners” as an example of using functions. :slight_smile:

:wink: