Target object via variable

0 favourites
  • 8 posts
From the Asset Store
Forget about default textbox restrictions, you can create sprites atop of the textbox
  • ok didnt see anything like this in the tuts, atleast not with a search

    I am thinking i might need to use global variable text arr ie "|en1|en2" etc

    how can I target an object via a specific variable?

    Ie i set one objects variable to enemy.UID

    So that this object can behave towards this specific ID

    so if variable = enemy, behave towards this specific instance of this object

    Does that makes sense? is this possible?

    if not how about putting the enemy in the array ie global text variable = "|en1|en2"

    target the specific object via int(tokenat(globalar,slot,"|"))

    and then the object i want to act towards this specific object can get the slot in the array, and target it that way?

    does that make sense? are these things possible?

    is this something i need a standard version to do?

    Note: im trying to avoid using tons of for statements to target both objects

  • for each object

    object: if variable = what youwant

    I think that is all you need? If not, could you please try to be a little clearer on what you want.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • omfg hating this forum it logged me out and deleted my message grrrrr!~

    thats just it i want to do it without the for statement

    I want to say object1.variable = object2

    Oject1 do thing to Self.Variable'

    I want to target the specific object by getting the objects variable without tons of laggy for statements

  • omfg it deleted my post again and made me retype it!!!!

    *pant pant*

    for example     Self.X = Self.Variable.X   the variable being the other objects name instance

    again trying to do it without laggy for statements

  • seriously? no way to do this? is this something famalies do automatically?

    dont act like im talking in tongues, any other coding language can do this,

    variable = object

    this.X = variable.X   the variable being the target name

  • Explain/show some context. You probably have a game situation where you need to do something like this. It's easier to explain with context.

  • eh, not sure if it matters from what i can tell you HAVE to have the for statement to target both object types:

    For each object 1

    for each object 2

    if object 1 variable = object 2 unique id, follow this object

    i mainly wanted it so i can do different monster types and only use 1 animation i did using image points

    the arm, leg head etc will be seperate, and will attach to the unit it self, so i want it to follow the image points animation of the specific object it is attached to

    ( the objects for example arm will get the point and rotation of the image points in the animation to determin its position, making an animation, I do this so i dont need 8 billion sprites to have different looking characters running left right up etc, as it is going to be isometric)

    I dont want to use ' get closest' because should 2 units get really close to eachother I dont want limbs betraying their object body XD

  • only one of the "for each"s are needed

    object1 is the child object type,

    object2 is the parent object type.

    For each object1

    object2 | Pick instance with UID object2.variable

    ---- object1| follow object2

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