Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Making a colored tile game, need help with a bug
- Drillem1
-
21 posts
Making a colored tile game, need help with a bug
So, I'm working on a colored tile game based on a phone game I play with my friend. It's called filler. There's a randomly generated 8 * 7 board of 6 different colors of squares. You and your opponent start in opposite corners of the board. You have to pick a color from the six options, apart from the current color of your square and the current color of theirs. When you pick this color, all the squares of the same color adjacent to the 4 cardinal directions of ANY square in the color group will be added to your score. If this is difficult to visualize, imagine two groups of squares increasing in size each turn by changing to a different color (to match colors it is currently touching).if it's still difficult, I'm happy to share it temporarily. Anyway, I have most things working, but I continue to have an error where a square of the color you just chose, all the way across the board, and therefore not a part of the group, adds itself to the group anyway. Squares determine if they should be part of the group by checking the color of the box directly above, below, and to the left and right of them. If any of those colors match, it adds itself to the group. I've tried lots of conditionals to fix this, and none work. If anyone has any ideas, I'd love to hear them! Also, let me know if I should share it.
Last edited by Drillem1 (March 12, 2025 00:03:19)
- 102acrimea
-
100+ posts
Making a colored tile game, need help with a bug
I would recommend making the filling algorithim tick based where once a colored tile is chosen, it firstly sets a variable to the colour, then it converts itself into a special tile and starts to run several ticks where:
- All tiles of that variable check if they are next to a special tile
- Change themselves if so
- Run another tick
Ticks would end when no change occurs on the previous tick
Then change all special tiles to the current players turn tiles.
- All tiles of that variable check if they are next to a special tile
- Change themselves if so
- Run another tick
Ticks would end when no change occurs on the previous tick
Then change all special tiles to the current players turn tiles.
- Drillem1
-
21 posts
Making a colored tile game, need help with a bug
Thank you! This was causing me huge problems, but I used some of you advice and now it is working beautifully. I would recommend making the filling algorithim tick based where once a colored tile is chosen, it firstly sets a variable to the colour, then it converts itself into a special tile and starts to run several ticks where:
- All tiles of that variable check if they are next to a special tile
- Change themselves if so
- Run another tick
Ticks would end when no change occurs on the previous tick
Then change all special tiles to the current players turn tiles.
The game is shared if you want to check it out

https://scratch.mit.edu/projects/1145249910
- Discussion Forums
- » Help with Scripts
-
» Making a colored tile game, need help with a bug