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

  • 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.

  • guannstar, could you share the .cpx so we work directly on it?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hey 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?

  • Have you actually tried doing this yourself? It's not that difficult.

  • dop2000 Yeah, I did, but to be honest, I still didn't get it. Thanks man.

  • 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.

  • 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!

  • 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.

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

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

    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)[/code:31ny4hvn]
    
    Now you can change this formula to whatever you want. Try one of these:
    [code:31ny4hvn]tokenat (namesDefault, loopindex("tileX"), ",")
    tokenat (namesDefault, loopindex("tileY"), ",")
    tokenat (namesDefault, loopindex("tileX") * (FIELD_WIDTH-1) + loopindex("tileY"), ",")[/code:31ny4hvn]
    
    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")
  • dop2000 Once again... Thanks man!

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