When I press the “a”, key two objects appearer, a TextObject (number 1) and a SpriteObject (a circle). Both at position Z100,Y100. The TextObject above the the SpriteObject (TextObject Z layer 2, SpritObject Z layer 1). Both objects can then be dragged separately to a different location.
“a” key is pressed a second time and two more objects appera at the same location (Z100,Y100). This time the TextObject is the number 2, the SpriteObject is a second instants of the circle. Both objects can then be dragged separately to a different location.
“a” key is pressed a third time and two more objects appear at the same location (Z100,Y100). This time the TextObject is the number 3, SpriteObject is a third instant of the circle. Both objects can then be dragged separately to a different location.
What I want to be able to do is drag the circle and the number that it appeared with. So after the first time I press the “a” key and drag the circle to another location the number 1 stays attached to it.
This is what I’ve got so far (With help from MayhemCats)
Ooh! You want the “A_CircleText” object to be dragged along with the “A_circle” object?
I think I know a way to do this. ^v^ All we need to do is take into account the values of the “Number” object variables in both the “A_CircleText” and “A_circle” objects, and do this:
For each NewObject object:
If variable "Number" of TextObject = NewObject.Variable(Number)
do = NewObject.X() + (TextObject.Width()/2) ; = NewObject.Y() + (TextObject.Height()/2) to the position of TextObject
This will make sure that each NewObject instances and TextObject instances with the same value in the “Number” variable will be “connected” in a way - and TextObject will be centered inside NewObject, and will “follow” it as you drag NewObject around.
If you don’t want it to be centered you can change up the expression. ^v^ I just assumed it’d be good if it was centered!
You DON’T need to add the Draggable Behavior to TextObject when you’re doing this. It will just follow NewObject regardless. Only NewObject needs the Draggable Behavior for this to work, not TextObject.
In order to use the expressions in that example, replace “NewObject” with “A_circle” and “TextObject” with “A_CircleText”. ^^