Ask here your questions to get help using GDevelop.
User avatar
By erdo
#44262
komencanto wrote:Is it possible to change the origin point at Tiled sprite? For example, from left upper corner to the center point of it.


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?
Last edited by erdo on Tue 29 Jul 2014, 19:56, edited 1 time in total.
User avatar
By erdo
#44265
komencanto wrote:
erdo wrote: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̶.̶

So, how to do it? :)


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:

Code: Select allX = 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:
(4.52 KiB) Downloaded 185 times


Good luck! ;)
User avatar
By erdo
#44273
komencanto wrote:Thanks for replies and the example - will use it in the topic "Tips for Beginners" as an example of using functions. :)


;)