How do I check if certain object exists?

0 favourites
  • 7 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • I have an object instance with variables X = 0 and Y = 0.

    I need to check if instance with variables X = 1 and Y = 2 exists to fire a function.

    How can i do this without loops and JS? I know i can do that, but cant figure out how.

    I need something like if object with X = 1 and Y = 2 doesnt exist - do something.

  • I guess you are thinking too complicated. You can actully code it exactly like you already said it (or i misunderstood).

    Basically just check if object X = 1 and object Y = 2

    If an object exists with those variables, the action will trigger. If no object exists with those variables, it doesn't.

  • If an object exists with those variables, the action will trigger. If no object exists with those variables, it doesn't.

    I need exactly opposite - if object DOESNT exist with given PAIR of vars. =(

    For example - check if object(1,1) doesnt exist, create obeject(1,1).

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Oh okay, then click on each event and press "i" :]

  • do the above and add an else below where you do the actions you want.

  • Oh okay, then click on each event and press "i" :]

    But it will mean any object where X != 1 and Y != 2. Its not the same. Am i wrong?

    do the above and add an else below where you do the actions you want.

    Hmmm... this sound reasonable. I'll try. Not exactly what i want, but should work, i guess.

  • > Oh okay, then click on each event and press "i" :]

    But it will mean any object where X != 1 and Y != 2. Its not the same. Am i wrong?

    > do the above and add an else below where you do the actions you want.

    Hmmm... this sound reasonable. I'll try. Not exactly what i want, but should work, i guess.

    The above is exactly what you need, the Else is where it runs if the instance doesn't exist with those variable values.

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