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

Get help using Construct 2

Post » Mon Jul 10, 2017 3:23 pm

Hi, I need help in my hextile type word puzzle.

how do I make word letters in connection?

For example : the word is "wonderful"
Image

but I need all letters of "wonderul" in connection in random direction or position?
How can i do it? any ideas?
capx: http://englishpedia.net/kk/wordaholic.capx
Check out my first word hex game: Hexagon Game
B
16
S
9
G
2
Posts: 25
Reputation: 2,454

Post » Mon Jul 10, 2017 6:13 pm

Sorry but I didn't understand what you want. What you mean by "connection" ?
B
6
S
1
Posts: 29
Reputation: 408

Post » Mon Jul 10, 2017 6:40 pm

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.
Check out my first word hex game: Hexagon Game
B
16
S
9
G
2
Posts: 25
Reputation: 2,454

Post » Tue Jul 11, 2017 3:47 pm

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
B
6
S
1
Posts: 29
Reputation: 408


Return to How do I....?

Who is online

Users browsing this forum: Google [Bot] and 12 guests