How to pick a particular sprite from all sprites in layout?

0 favourites
  • 5 posts
From the Asset Store
Pick Up Items Sound effects for your game, Take them for a ride right now and you will worry no more.
  • I need a way to be able to pick a particular sprite from all the sprites in the layout. I only see ways of picking from particular object types. I am trying to build an onscreen borad, and the link on the FAQ board does not have the capx file anymore. I need to be able to detect which keyboard button is being clicked on and append a character accordingly to a textbox. I do not have the pro version, so I cannot use families. Also I have differetnt object types for each key.

    Any suggestions on this?

  • If you have many instances of the same sprite, you can pick it via its UID or you can make an instance variable and set that when the object is created to a unique number. You can use this instance variable as a picking condition

    You can detect keyboard buttons by using the keyboard object in your project, and creating a condition using the keyboard object "is key being pressed". You can assign instance variables to your text boxes as well, to give them a unique identifier - the same way as the sprites. You could even match the unique variable between the sprite and the text box (which is what I assume you're wanting to do).

    You don't need families for this to work


  • Hi

    Thanks for the reply . As mentioned, I do not have multiple instances of the same sprite (object type). I have multiple object types with one instance for each one of them. I do not think there is any way to pick from different sprites unless they are the same 'object type'. Am I right? I saw that is supported with families though.

    I do not need to detect keyboard buttons as of now, since I am building an onscreen keyboard, with all the buttons on the screen

    Thank you!


  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Yeah if you're trying to have many object types with multiple variations and instances of each type, then yeah... you kind of need families since that's what they're there for. I'm not sure of an easy way to make a reference without basically rebuilding the family functionality using events. It's been done a long tie ago before families were added to C2 in it's early stages of development... but even then it was clunky and didn't have full functionality from memory.

    You may have to bite the bullet, and buy the full version... or figure out a different way to achieve what you're trying to do... however someone else may have a better solution.


  • Yeah. Thanks for the insights!

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