i’m trying to create an object above another but since the height of the objects vary sometimes as I work on them, I’d like it to be a little more dynamic.
Say I have obj1 and obj2, both 100px in height.
I’ll do: create obj1 at 0;obj2.Y()-100
So that works, boom obj1 is on top of obj2
What I’d like to do but doesn’t work is this:
create obj1 at 0;obj2.Y()-(obj1.Height())
Thought that would be clever when obj1 height changes.
Also tried to register the height as an obj variable in obj1 but that gave me the same result, which is none.
I’m clearly calling on the height variable in a wrong way because it doesn’t register as “100px” (in this instance).
Could you please help understand this? I scoured through the variable page but it’s still quite opaque for me in some areas
What Jumpingj suggest will work
But sometimes you wanna change position of something without doing it only once like at beginning of scene or with trigger once
Then
Lets imagine you have objectA and objectB
And you want to place objectB somewhere in relation to objectA
And so instead of subtract you also go with set to
BUT
ObjectB
Above objectA
Change Y pos of objectB set to ObjectA.Y()-ObjectB.Height()
Below objectA
Change Y pos of objectB set to ObjectA.Y()+ObjectA.Height()
Right from objectA
Change X pos of objectB set to ObjectA.X()+ObjectA.Width()
Left from objectA
Change X pos of objectB set to ObjectA.X()-ObjectB.Width()
Ah! Maybe because the object you reference and want to subtract to its position, its height, doesn’t exist yet. So it can’t be referenced at the “create object” but after it can, thus changing its position works. Cool stuff!