How do I add a Text object to every Obstacle object?

Get help using Construct 2

Post » Thu Jul 23, 2015 8:57 pm

I would like to put a little text object on each and every obstacle object to report numbers and details for the player. It seems simple enough for me to create N obstacle objects and then add N text objects but it's not clear to me how I should go linking the two. The instance variables, for instance, only hold numbers, booleans and strings, not pointers to objects.

Any suggestions for how to do this elegantly and in a way to allow for future expansion? Ideally, I would like to just create N pairs of obstacle objects and text objects with a loop instead of drawing them by hand.
B
4
Posts: 5
Reputation: 217

Post » Thu Jul 23, 2015 9:10 pm

First just add instance variable "parent" type number to your text object (eg "linktext")
then you can try the following events:
On "Obstacle" create: system create text"linktext" layer "your layer" at X,Y
--- text"linktext" set value "parent" to Obstacle.UID

Text and Obstacle object are linked by Obstacle.UID
Image Image
B
26
S
15
G
142
Posts: 881
Reputation: 74,060

Post » Thu Jul 23, 2015 11:49 pm

ImageImageImage
B
71
S
22
G
257
Posts: 3,791
Reputation: 142,698

Post » Fri Jul 24, 2015 1:37 pm

Thanks. I ended up using a container. It seems to work pretty well.
B
4
Posts: 5
Reputation: 217


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 3 guests