Tiled object origins - its a real can of worms

I’m creating a user level builder for my latest game and at one point i need to replace a sprite object with a tiled object. ‘Is someone paying you to do that?’ my wife questioned last night - well no - i do this for fun!! I’m struggling to get to grips with the algorithm at play when determining the origin of an angled tiled sprite.
My objects are all angled at multiples of 45 and the height is set at 32. Here’s a screenshot of what works for 0,90,180,270 degrees - but what of 45 etc? It seems to be that you need to deduct half of the cosine of the angle times the width plus a bit extra - whats that bit! what is it !! @Keith_1357 - copied you in because i thought you’d know

I should have pointed this bit out… - in the level builder that i’ve created, it’s much easier to control the paths position as a sprite object with the center and origin at one end on the x and in the middle on the y, but in the game, the path is a tiled object, and i’ve created all the levels by positioning them in g develop. And so if I don’t adapt the positions then they’re not in the right spot when the path is angled
!
Screenshot 2025-05-29 120152|690x255

Could you use the action “Put around a position” on the path object?

Other than that, I’m not clear on what you are doing. It appears you are placing tiles from their saved details. If you already have the X & Y co-ordinates of the tile, why do you need to recalculate the position? If they’re saved from a previous edit, why don’t you store the exact position and rotation?

Thanks for helping - what i’m doing is - in the level builder that i’ve created, it’s much easier to control the paths position as a sprite object with the center and origin at one end on the x and in the middle on the y, but in the game, the path is a tiled object, and i’ve created all the levels by positioning them in g develop. And so if I don’t adapt the positions they’re not in the right spot. I can’t get my head around the algorithm for the x y of a tiled sprite when it’s at an angle.

i think - I’ve got my head around it now! I need to subtract the cosine of the height and half the cosine of the width - or summat!

Can you give a visual of how you want the tiles to fit together? How does the angled tile fit in relative to tiles rotated at the various degrees? I’m just not able to picture it in my head.


ive attached a pic.sorry i know - its a difficult one to explain - i should have used sprites instead of tiled sprites in the game in retrospect but it’s a bit too late to change that!

I can see what you’re trying to achieve, and my advice is to use sprites. Changing it to sprites may be hard, but it’s a lot easier than working with the tiled sprite. You’re making it ridiculously complex using a tiled sprite, and it’s not an area most of the forum members will be able to help with.

The calculations using a normal sprite will be a load easier, particularly if you have the path object’s origin at the centre of the path sprite for both the level builder and game. Then it just becomes a case of saving the position, angle and length.

1 Like

Thanks @MrMen - I’ve decided to change to using a sprite object throughout for the path - it’s of a bit of a chore, but hey ho!
Dev team - if you happen upon this thread then could i request a ‘fix origin’ check box on tiled sprites with at least two options ‘centre’ an ‘top left’