How do I detect on which sprite of a family the user has clicked or tipped?

0 favourites
  • 4 posts
From the Asset Store
Click! Click! 136 click sounds for your video games or media projects
  • I am quite new to Construct and have the following question/problem:

    I try to build a little search game in which the user should find different objects on the screen.

    There are about 30 different objects (or sprites) on the screen. Some of them are correct findings the others not.

    To avoid to create the same events for each of the sprites I have put all of them into a "family"-group.

    In the event sheet I can add an event for the whole family but wonder how I can detect which sprite of the familiy the user has clicked on.

    When the users clicks on one of the families sprites I need to know which one it was to check if this one is a correct or a wrong finding.

    Is it possible to get the name or id of the sprite? Is there something like "me.name" or "this.name" in Construct?

    Thanks in advance for your help.

  • You can check the family object's "ObjectTypeName" property to find the name of the sprite. You can also give the family instance variables, and then assign each sprite in the family appropriate values.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thank you very much for your answer.

    I had some slight difficulty figuring how and where to use the expressions from the expressions dictionary but finally found out how this works.

    If you have a minute for it:

    I would like to use an array variable to store and compare the names of the objects the user should find.

    The manual says that an array should be added into the files folder of the project browser. I did so and could populate the array with the objects names.

    Unfortunately I cannot find the arrays from the files folder as options when adding a new condition to my event sheet.

    Obviously I am doing something wrong. It would be very nice if you could give me a little hint how to do this right.

  • if it is in the files folder, you need to use AJAX to request it at the start of your layout.

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