Variables that can hold objects and objecttypes

0 favourites
  • 6 posts
From the Asset Store
Easily store, modify, read and manipulate colors with Color Variables!
  • I was wondering if there were plans to have variables that aren't limited to numbers/text/boolean, but can also hold objects and objecttypes.

    For Construct Classic you can basically do this with lucid's S plugin and I think it's an incredibly useful feature and therefore should be built-in.

    I didn't follow C2 development as close as I should have, so chances are I might have missed discussion about this matter. Feel free to enlighten me. <img src="smileys/smiley9.gif" border="0" align="middle" />

  • You can "store" an instance in a variable by storing its unique ID (UID) in a number variable. To get it back, you just use a 'pick by UID'.

    You can also reference an object type simply by storing its name string in a text variable, but I'm not clear what you would want to do with that.

    Similar techniques work in Classic. It's an interesting idea, but I'm not clear what it would allow you to do that you can't do with the above. How exactly will it work with the SOL/picking algorithms?

  • You can "store" an instance in a variable by storing its unique ID (UID) in a number variable. To get it back, you just use a 'pick by UID'.

    You can also reference an object type simply by storing its name string in a text variable, but I'm not clear what you would want to do with that.

    Similar techniques work in Classic. It's an interesting idea, but I'm not clear what it would allow you to do that you can't do with the above. How exactly will it work with the SOL/picking algorithms?

    Fair enough, I think for most uses this would work perfectly well and using PVs with UIDs is being done in CC quite regularly, you're right. Maybe I was overthinking the matter.

    Also these features exist in S not with simple variables, but one-dimensional arrays, which is a different story. Like iterating through a specific list of objects easily or saving/loading levels with a custom editor.

    Maybe that's what should have been my intention with this thread: how about the superstructure kind of arrays/functionality for C2? <img src="smileys/smiley9.gif" border="0" align="middle" />

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I would think that the ability to add variables in events would work for that.

  • Hi Ashley,

    What if I want to pick an object and join it with the parent. like the following

    system | for each anchor

    anchor | pick nearest to (anchor.x,anchor.y)

          Create revolute joint for the parent anchor with the picked one

    I wish there is something like .parent

    or if there is away to write some Javascript.

  • haroonjoblo

    This is a very old thread. If you have questions, you should make a post in the "How do I?" section of the forums. There are usually plenty of people who can offer help without us having to bother the only developer of the software.

    As for your question, if you have a look at the "Example of realistic rope" thread in the FAQ, I think you'll find the solution to your problem.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)