hello everyone, i am trying to figure out how to make a checking mechanism for my trivia game
basically the game is about 5x5 hexagonal grid where each grid has a letter and it include a host and two teams
as you can see the team yellow need to make a connected line from top yellow to bottom yellow and the orange team needs to do the same but from left to right
the game start by the host choosing a random cell to start with, and give a question that it answer start with the same letter, the team that answer correctly gets the cell colored and choose the next letter trying to connect their line
now for what i need help and ideas for is how to make mechanism that activate a variable automatically by checking if there’s lines connected
that’s the win screen for orange but i have to pop it up manually
all the cells are separated objects include the yellow cells, orange cells and the letters
Are you familiar with the linked tools behavior. It could simplify things.
https://wiki.gdevelop.io/gdevelop5/extensions/link-tools/
You wouldn’t need to use a visible mover object. The Tactical example might help with the basic setup. If the tiles are marked with the color similar to the terrain type the you could check if the mover that was linked to one side could reach the other section.
1 Like
Here is another method that’s easier to do but may or may not be difficult to describe and understand . It’s based on finding a path for the classic pipe game.
I’m on my phone, otherwise I’d upload my project to my github.
You use an array of structures who have X and Y children. You seed the array with a starting tile X, Y. I used a tile object with 3 animations, white, red and blue. It has the Object variables Start, End and checked. The center top object has Start set to True. The bottom center has End set to true. All of the bottom tiles could have End set to true.
Basically, you start with the tile who’s Start is set to true. You add it’s X, Y to the Buffer array and set Tested to True. You then place a test object at that location. The test object is large enough that when centered over a tile that it collides with the neighboring objects.
As you test objects, you remove them from the array and add the colliding objects to the Buffer array.
If the object animations are. the same as the current color then you add them to the array.
If the Tile object variable End is true then a path is found and PathFound is set to true.
The While event loops until either the array is empty or PathFound is set to true.
Scene
Objects
Tile animations
Tile variables
Scene variables
Local variables. I used 1 set of local variables. That could be switched to scene.
Events
I used a button for testing. I used a toggle or switch to choose which animation to use. The 1st event group sets the animation to Red if the toggle is checked.
The CurrentColor variable is used to decide which player to check. You could create an array with both colors and use for each child to test all of the players. You could put the other events as subevents of the for each child.
1 Like
thank you so much for your efforts, I’ll give these a shot and see how they go.
1 Like