C
ChillAssLofi
Guest
Hello. I have a question for you guys. I am currently making a game that's sort of like a word find. (You know the jumble of letters, and you try to find words hidden inside?) Well I have 99% of it done, but there's one very big problem with it. Let me explain the basic idea first. There's a 10x10 grid of randomly created tiles that all have letters on them. You click these tiles, and it spells out the word you're "typing" along the top of the screen. If you deselect a tile by clicking it again, the last letter in the word you're spelling gets deleted. But if you click one of the tiles from the middle of the word you're spelling out, it still just deletes the last letter, and not the letter corresponding to the tile. This actually makes it possible in my game to cheat easily. Let's say you're spelling "sassy", just because it has a bunch of S's in it. On the board, there is only 2 S's in the whole thing. You can unselect one of them, (erasing the last letter you "typed") reselect the letter you just lost, and use the unselected S again in the word. Which completely defeats the point of the game. So I need a way to erase a specific letter, when that specific letter's tile is deselected, and have it erased from the string.
Just so you know, I'm not exactly new to GML, but I can for sure say I am not great at it. I know for loops, ds grids and arrays are probably the answer to my problem, but I just don't grasp the ideas behind them, so I thought of a different way that seemed like it would work at the time I wrote the script. I thought, what if I checked the width of the string, made sure it was between range 1 and range 2, and if it is, delete the letter from the string using string_delete(); and the correct position of the letter I want gone. In my head, this should have 100% worked, in reality it 100% did not. In fact, it just deletes the entire string, which I could have done far easier than writing a script for it. lol
Below is a screenshot of the code I wrote. Can someone please explain 1) why the hell does this script not work the way I think it should, and 2) can you please give me some pointers or something about how to solve this problem, because I'm tired... I'm so tired.
Just so you know, I'm not exactly new to GML, but I can for sure say I am not great at it. I know for loops, ds grids and arrays are probably the answer to my problem, but I just don't grasp the ideas behind them, so I thought of a different way that seemed like it would work at the time I wrote the script. I thought, what if I checked the width of the string, made sure it was between range 1 and range 2, and if it is, delete the letter from the string using string_delete(); and the correct position of the letter I want gone. In my head, this should have 100% worked, in reality it 100% did not. In fact, it just deletes the entire string, which I could have done far easier than writing a script for it. lol
Below is a screenshot of the code I wrote. Can someone please explain 1) why the hell does this script not work the way I think it should, and 2) can you please give me some pointers or something about how to solve this problem, because I'm tired... I'm so tired.
Attachments
-
101.1 KB Views: 23