- #1
Darkmisc
- 203
- 27
- TL;DR Summary
- I have twelve buttons that are constantly moving. Sometimes they don't do what they are supposed to when pressed. Is it because I have too many things running simultaneously?
Hi everyone
I made a game for memorising Scrabble two-letter words. When you press a tile, it lights up and a button_on variable gets set to true. If the two tiles you press form a valid two-letter word, the tiles disappear (and get replaced with new tiles). I have 12 tiles running at any given time. The left column scrolls down and the right column scrolls up.
The game runs fine for the most part, but very occasionally when you press a pair of tiles that form a valid word, the tiles will light up but not disappear. (They will disappear if you press on the tile a second time)
I suspected it was because I was running too many functions at once, and maybe the button_on=true line gets missed. All the buttons belong to the "all_buttons" group and they all have a "word_made" function that gets called when a valid word is made. I gave each button its own group (i.e. one, two, three... twelve) and instead only called functions for two buttons whenever a word was made. This made the problem appear less frequently, but didn't eliminate it.
I also tried using physics_process instead of _process, but I'm not sure if this made any difference.
Am I correct in suspecting the problem stems from running too many things at once? I tried using only ten buttons, but that didn't eliminate the problem.
I had also labelled each button (not in screenshot) and kept a track of which pairs failed to light up. I've retried those pairs and they almost always work as intended.
Am I right in guessing that I'm running too many things at once? If so, can the problem be fixed?
Thanks
I made a game for memorising Scrabble two-letter words. When you press a tile, it lights up and a button_on variable gets set to true. If the two tiles you press form a valid two-letter word, the tiles disappear (and get replaced with new tiles). I have 12 tiles running at any given time. The left column scrolls down and the right column scrolls up.
The game runs fine for the most part, but very occasionally when you press a pair of tiles that form a valid word, the tiles will light up but not disappear. (They will disappear if you press on the tile a second time)
I suspected it was because I was running too many functions at once, and maybe the button_on=true line gets missed. All the buttons belong to the "all_buttons" group and they all have a "word_made" function that gets called when a valid word is made. I gave each button its own group (i.e. one, two, three... twelve) and instead only called functions for two buttons whenever a word was made. This made the problem appear less frequently, but didn't eliminate it.
I also tried using physics_process instead of _process, but I'm not sure if this made any difference.
Am I correct in suspecting the problem stems from running too many things at once? I tried using only ten buttons, but that didn't eliminate the problem.
I had also labelled each button (not in screenshot) and kept a track of which pairs failed to light up. I've retried those pairs and they almost always work as intended.
Am I right in guessing that I'm running too many things at once? If so, can the problem be fixed?
Thanks