How to find out particular instance of an object present the in layout.

0 favourites
  • 4 posts
From the Asset Store
112 High-Quality destruction sounds for videogames
  • Multiple instances of the same object are present in the layout, eg. "Canon_IV", HP_IV Samsung_IV etc. How to check whether the same object having the instance variable of "Canon_IV" is present or not in the screen. If that present I want to perform an action if not will perform another action.

    Please help.

  • Your description is pretty confusing.

    Do you mean the value of an instance variable for the object type can be "Canon_IV", "HP_IV", "Samsung_IV"... ?

    If so, simply check for the value of this instance variable, it will select only the instances that have this value in their instance variable.

    Add another event with an "Else" special condition, that will only execute if the prior event wasn't executed.

    Consider posting your project if you are further struggling.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Yes,

    In the layout, there are multiple instances of the same object (eg "Enemy_Sprite") , each of them having a different instance variable. eg. "Canon_IV", "HP_IV", "Samsung_IV" etc.

    I just need to find whether there is an instance of "Enemy_Sprite" having the instance variable of "Canon_IV" present in the layout.

  • As indicated in my previous message, and as events work :

    Have an event with the common feature condition that checks the value of an instance variable :

    Enemy_Sprite -> Compare instance variable -> Variable 'VariableName' is equal to "Canon_IV"

    This event will have selected any instance of "Enemy_Sprite" that has its instance variable value set to "Canon_IV".

    Next have an event with the system special condition "Else" and this event will only execute if the previous event has not executed, that is to say that no instances were picked, since no instance apparently had its instance variable value set to "Canon_IV".

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