How do I make a simple search bar for drag and drop objects?

Get help using Construct 2

Post » Thu Sep 14, 2017 3:41 pm

Hey @guannstar!

I'm not sure if that's what you want. I just created a grid filled all its positions with tiles that have random names attributed to them and you can search this grid by writing a name and hitting enter.

https://www.dropbox.com/s/fq6jw6i9pbpyo ... .capx?dl=0 [Link Fixed]

This is ONE way of doing it. There are others, but, since I'm not sure about your use of this functionality, I just implemented this one. :)

Hope that helps. Cheers!
Last edited by brunopalermo on Thu Sep 14, 2017 4:15 pm, edited 1 time in total.
Bruno

I like to eat, but I'm no cook. Why liking to play games would make you a game designer?
B
22
S
6
G
3
Posts: 722
Reputation: 4,026

Post » Thu Sep 14, 2017 3:46 pm

You didn't provide much details... As brunopalermo mentioned, there are too many ways to do this.
Here is an example I put together with an array and tilemap.
Basically you store data in the array and search the array.
https://www.dropbox.com/s/huidjt15mmjf6 ... .capx?dl=0

@brunopalermo you beat me by just 5 minutes! :)
Image

Did I help to fix a problem in your game? You can buy me a cup of coffee :) If you'd like to hire me, please see this post
B
19
S
9
G
158
Posts: 2,401
Reputation: 84,429

Post » Thu Sep 14, 2017 3:48 pm

Another way would be using a 12 x 7 array and every time you drop something at a position you set that positions value to the name of the dropped object. Every time you start dragging you would set the original position to empty. The a simple loop would tell you where it was found.
Bruno

I like to eat, but I'm no cook. Why liking to play games would make you a game designer?
B
22
S
6
G
3
Posts: 722
Reputation: 4,026

Post » Thu Sep 14, 2017 3:49 pm

dop2000 wrote:@brunopalermo you beat me by just 5 minutes! :)


Hahahahaha... Most of the time YOU beat me! :)

It seems we're spending too much time in this forum... :shock:
Bruno

I like to eat, but I'm no cook. Why liking to play games would make you a game designer?
B
22
S
6
G
3
Posts: 722
Reputation: 4,026

Post » Thu Sep 14, 2017 3:51 pm

True :)
Also, your example doesn't work :)
Whatever I type in the search box, it tells me "not found".
Image

Did I help to fix a problem in your game? You can buy me a cup of coffee :) If you'd like to hire me, please see this post
B
19
S
9
G
158
Posts: 2,401
Reputation: 84,429

Post » Thu Sep 14, 2017 4:10 pm

Weird... I double checked hereand it was working fine...

[EDIT} No, you're right. I must've messed up and deleted the checkArray. Just fixed it... Duh!

https://www.dropbox.com/s/fq6jw6i9pbpyo ... .capx?dl=0

Thanks for the heads up, man!
Bruno

I like to eat, but I'm no cook. Why liking to play games would make you a game designer?
B
22
S
6
G
3
Posts: 722
Reputation: 4,026

Post » Thu Sep 14, 2017 8:51 pm

@brunopalermo @dop2000 That was an awesome array capx (I didn't know how to do that either - so thanks)... but I don't think I explained well enough... I need it to search for a specific piece 'changeable text'/or name (that the user can change later... if he/she wants to change the character name later on. Every time the user changes the character's name, the new name should show up as a search result. Do you who what I mean?
B
50
S
14
G
3
Posts: 718
Reputation: 5,990

Post » Thu Sep 14, 2017 8:57 pm

Like a wall of characters (objects). On each character, is pinned a changeable piece of text/the character name, the user can change at any time. Once the name has been changed, the new name, when searched for, should be highlighted on the "wall of characters"/objects.
B
50
S
14
G
3
Posts: 718
Reputation: 5,990

Post » Fri Sep 15, 2017 5:12 am

Here you go:
https://www.dropbox.com/s/yuk22m8kmjxv8 ... .capx?dl=0

I changed brunopalermo's project as it is way better looking than mine and better suited for this task.
Hope it's ok @brunopalermo ? :)
I got rid of the arrays and added an option to click any tile and change its name.
Image

Did I help to fix a problem in your game? You can buy me a cup of coffee :) If you'd like to hire me, please see this post
B
19
S
9
G
158
Posts: 2,401
Reputation: 84,429

Post » Fri Sep 15, 2017 6:05 am

@dop2000 That's just what I was looking for. Thanks so much!... Just one thing, now the names are all random. How do I fill in each box with specific names?
B
50
S
14
G
3
Posts: 718
Reputation: 5,990

PreviousNext

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 2 guests