[Behaviour] Store Reference

0 favourites
  • 9 posts
From the Asset Store
A system for storing and processing information online
  • <font face="Verdana, Arial, Helvetica, sans-serif"><font size="6"><center><img src="https://dl.dropboxusercontent.com/u/94904214/Store-reference/code-imgs/PluginIcon.png" border="0">

    Store Reference Behaviour (v1.0)</center></font>

    Current problem in Construct 2:

    It is not very straightforward to stablish relationships between gameobjects. If two objects A and B are related, then A must keep a variable with B's IID or UID and then keep checking which object has that id value. This may lead to repetitive code to keep variables that don't really store the object B, but only its identification.

    Besides that, that way of coding doesn't allow you to keep, for a same object, a relationship to a variable amount of objects (unless you store IIDs or UIDs on an Array object, but that will increase the complexity of your project a lot).

    The Behaviour:

    Instances can hold Text, Boolean or Number variables. This behaviour creates the possibility for Object variables, in which you can store and retrieve objects. It allows your object to have as many variables as you want.

    This is how you store objects:

    <img src="https://dl.dropboxusercontent.com/u/94904214/Store-reference/code-imgs/collision.png" border="0">

    And this is one of the ways to retrieve them:

    <img src="https://dl.dropboxusercontent.com/u/94904214/Store-reference/code-imgs/launch.png" border="0">

    As you can see, object variables are different from the usual variables because they are actually an array of objects. That gives you much more power to hold as many objects as you want.

    I hope you enjoy it. Suggestions are welcome!

    Links:

    Behaviour Download (v1.0)

    Example

    Github Repository</font>

  • Super Plugin!!!

    Great Work <img src="smileys/smiley32.gif" border="0" align="middle" />

    Kind Regards.

    Savvy001

  • Yes very good

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I think it could be very useful, but it's not possible to establish relations between instances of the same object. I have a feature suggestion for your plugin, it's called reference by tag:

    • user can put a tag (string) into any object or instance and than set reference to that tag.
    • it is possible to pick referenced object/instances by tag
  • xoros

    How is that any different than an instance variable?

  • Yeah, that's true. Than call it reference by instance variable.

  • Seems useful !

  • Hi, I am a beginner,

    I like your behavior, would you please let me know how to set "owner" to player? thanks

  • My construct 2 is showing up aiyra debugger...

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