How do I make random pick but in connection with each other?

0 favourites
  • 4 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.
  • Hi, I need help in my hextile type word puzzle.

    how do I make word letters in connection?

    For example : the word is "wonderful"

    but I need all letters of "wonderul" in connection in random direction or position?

    How can i do it? any ideas?


  • Sorry but I didn't understand what you want. What you mean by "connection" ?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I mean the letters of the word "wonderful" will touch each other;

    the user can follow the the letters in a correct path " w - o -n - d - e -r-f-u-l" on a continuous touch.

  • I guess you don't want the user to pass through empty tiles.

    I think the best way is to do a recursive function. Suppose a word has L letters. Moreover, suppose you have a coordinate system to locate each tile. So each tile has an unique couple of coordinates, say (x,y) where x and y are integers. At last, you have an array where you have all the letters to place.

    You chose as an origin the point A(0,0).

    Then you create the recursive function "placeLetters" as follow

    PlaceLetters( (x,y), NumberOfLettersLeft) :

    if NumberOfLettersLeft >=1

    Randomly chose the couple C between (x+1,y) or (x,y+1) or (x+1,y-1)

    place next letter form the array on position C

    call function PlaceLetters(C,NumberOfLettersLeft -1)

    Initially, you call the function PlaceLetters((0,0),L), where L is the number of letters. Instez of L, you can put the length of the array.

    That way, your word will be continuously connected. The flaw is that the letters will be placed from the left to the right without ever going backward, but the path will randomly go high or down.

    To me, the coordinates system would go from left to right for the x-axis and from bottom-left to top-right for the y-axis

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