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

Get help using Construct 2

Post » Mon Sep 18, 2017 4:03 am

You need to modify the For loops where the tile grid is created.
Or you can destroy/hide the unwanted tiles after the whole grid is created.
How? Try to figure this out yourself. You'll never learn if we write the whole game for you.
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
17
S
9
G
127
Posts: 1,762
Reputation: 67,845

Post » Mon Sep 18, 2017 10:37 am

@guannstar, could you share the .cpx so we work directly on it?
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: 717
Reputation: 3,996

Post » Mon Sep 18, 2017 4:22 pm

Thanks @brunopalermo. Here it is... https://www.dropbox.com/s/kr5mgf8akzm4a ... .capx?dl=0
B
46
S
11
G
1
Posts: 659
Reputation: 4,466

Post » Wed Sep 20, 2017 5:37 am

Hey @brunopalermo. I still can't figure this out... Each row has twelve boxes. How could I make it so that one of the rows (row 'G') has six boxes, instead of twelve like the rest? How do I change the amount of cells/boxes of each individual row?
B
46
S
11
G
1
Posts: 659
Reputation: 4,466

Post » Wed Sep 20, 2017 5:56 am

Have you actually tried doing this yourself? It's not that difficult.
Image
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
17
S
9
G
127
Posts: 1,762
Reputation: 67,845

Post » Wed Sep 20, 2017 6:31 am

@dop2000 Yeah, I did, but to be honest, I still didn't get it. Thanks man.
B
46
S
11
G
1
Posts: 659
Reputation: 4,466

Post » Wed Sep 20, 2017 7:20 am

Try to figure out what every line of code does. Change/disable different bits and pieces one by one and see what happens.
Run your project in debug mode (Ctrl-F4), it's extremely useful when you are learning.
Also, google is your friend.
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
17
S
9
G
127
Posts: 1,762
Reputation: 67,845

Post » Wed Sep 20, 2017 1:40 pm

Hey @guannstar!

Been away for some days, just came back.

Not sure if that's what you need, but check the capx below.

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

Hope this helps. Cheers!
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: 717
Reputation: 3,996

Post » Sun Oct 01, 2017 11:24 pm

dop2000 wrote:Currently they are picked randomly from the "namesDefault" variable. You can update this variable, or if you need some other method - just change these 2 lines to whatever you want.
Image


Hey @dop2000, I've been trying to change the "set text to" line of code, but every time I try to change it, it says "'tokenat' does not take 2 parameters (should have 3)." How do I get rid of 'randomIndex' (and the randomizing of the names)?
B
46
S
11
G
1
Posts: 659
Reputation: 4,466

Post » Mon Oct 02, 2017 12:32 am

So in the namesDefault variable you have a string which is a list of animals separated by a comma (",")
The list looks like this:
dog,cat,cow,bird,fish,.......

Set text to tokenat picks one of these words from the string.
It needs 3 parameters - string, index (counting from 0) and text separator.
For example, if you want to pick the first word from this string (which is dog), you should do this:
Code: Select all
tokenat (namesDefault, 0, ",")

where first parameter:   namesDefault  (your string)
second parameter:   0   (index of dog in the string)
third parameter:   ","    (separator - which in your case is comma, should be in quotation marks)


Now you can change this formula to whatever you want. Try one of these:
Code: Select all
tokenat (namesDefault, loopindex("tileX"), ",")
tokenat (namesDefault, loopindex("tileY"), ",")
tokenat (namesDefault, loopindex("tileX") * (FIELD_WIDTH-1) + loopindex("tileY"), ",")


Or you can get rid of tokenat altogether and pick names using some other method.
Say, a simple random:
Set text to Choose("John","Mary","Steve","Samantha")
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
17
S
9
G
127
Posts: 1,762
Reputation: 67,845

PreviousNext

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 21 guests