Scirra / Construct-feature-requests

A place to submit feature requests and suggestions for Construct.
https://www.construct.net
11 stars 1 forks source link

access instances by UID in expressions: sprite[UID].x #365

Open F3der1co opened 1 month ago

F3der1co commented 1 month ago

Reviewed guidelines

Checked for duplicate suggestions

Summary

similar to sprite(iid).x it would be amazing to have the same functionality for uid.

Possible workarounds or alternatives

writing return functions for the specific properties you want to access by uid or using addons like UID TO ANYTHING by Overboy

Proposed solution

Same as objectType(iid).whatever but using uid. To differenciate between the two it would use square brackets objectType[uid].whatever

Why is this idea important?

While the picking system is often very helpful, it sometimes makes certain logic extremely complicated. Accessing instances in expressions by their uid would allow a great amount of flexibility!

Additional remarks

No response

F3der1co commented 1 month ago

https://github.com/Scirra/Construct-bugs/issues/7028 This was brought to my attention, so maybe a different syntax can be used. For example sprite(uid: 123).x. I don't know how the c3 expression lexer works, so I can just guess what would be feasible to implement.

dop2000 commented 3 days ago

Referencing by tag would also be very useful. UID can change, but tags will always remain the same. sprite["tag"].x Enemies["dungeon_boss"].health