How do I retrieve the value of any clicked or touched sprite

0 favourites
  • 3 posts
From the Asset Store
Surena Touch
$2.50 USD
A wrap from official Touch plugin to export touch/mouse input to other plugins.
  • Hi, a question of an enthusiast newbie. I hope this first post is in the right place. I hope also somebody has an solution for me. I can't find it myself yet.

    This is the situation:

    I have many different sprites with different names and different values stored in their instance variables (numbers).

    I know how to retrieve the value of every sprite separately by name, but I thought it would be easier, nicer and faster to make a function that I can use for all the different sprites with their different names and values to let them do the same Action.

    But how can I retrieve the value of that clicked or touched sprite, getting it's value only because it's clicked or touched, to use in a function?

    Or maybe that's not possible? Or is it simple and I can't find it?

    All help will be very much appreciated, thanks a lot in advance.

    Philip

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Sounds like you would need to put all your different sprites in a single family, have this family have a common family instance variable and each instance of each object type having a different value.

    This way "Touch: On touched FamilyName" will allow you to get FamilyName.InstanceVariableValue. (I hope this makes sense).

  • Thanks for the quick answer. Could not find out, how to deal with it, so solved the problem by copy and pasting a lot. Works fine, just more work.

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