Select UID on click

0 favourites
  • 3 posts
From the Asset Store
High quality sound effect pack, in the following categories: Simple, negative, pozitive
  • Is it possible to get an objects UID when on click? For example, I have many instances of a sprite Object "weapon." I would like to be able to click on a weapon in the game, and on click have it set it UID to an instance variable.

    I am using an array to store all the weapon stats, eg, attack, rate of fire etc. I would like to be able to click on the weapon and then find the array by comparing the instance variable UID to the array and finding the appropriate stats.

    Is this possible or am I going about it all wrong?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You should be able to do that using the "on object clicked" event in the mouse object. It allows you to select the sprite/object clicked on. You should then be able to get the UID through object.UID expressions.


    Event: On gun(sprite) clicked

    action: -> add gun.uid to myArray

  • Thank you! I did not know that clicking an object selected it, thank you very much!

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