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

Get help using Construct 2

Post » Thu Aug 03, 2017 1:48 am

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?
B
5
S
1
Posts: 3
Reputation: 331

Post » Thu Aug 03, 2017 3:50 am

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 :)

~Sol
Tired of crappy file hosts that are crappy? Get DROPBOX - https://db.tt/uwjysXJF
Moderator
B
84
S
34
G
40
Posts: 3,032
Reputation: 30,499

Post » Thu Aug 03, 2017 11:49 am

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!
Rahul
B
5
S
1
Posts: 3
Reputation: 331

Post » Fri Aug 04, 2017 12:29 am

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.

~Sol
Tired of crappy file hosts that are crappy? Get DROPBOX - https://db.tt/uwjysXJF
Moderator
B
84
S
34
G
40
Posts: 3,032
Reputation: 30,499

Post » Sat Aug 05, 2017 12:44 pm

Yeah. Thanks for the insights!
B
5
S
1
Posts: 3
Reputation: 331


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 10 guests