I was wondering how I could have a global variable increase when I’m typing. I wanna make a writing related game, so I need to know how if I want to continue.
I have it so the variable increases when any key on the keyboard is released, but the number doesn’t go up when typing into a text box.
If it helps to answer my question, this is all I’ve got right now since I don’t wanna go any further if it’s not possible.
I’m very new to Gdevelop, but I’m really enjoying it so far. Hopefully, there’s an answer to get what I want, but I’ll also accept alternatives. Please and thank you!
I don’t believe the keys pass through when the input object has focus. In your case that’s not a bad thing. You can use the expression Sting Length (StrLength) to get the count of the characters in the input box. The number can be used with compare 2 numbers I would use the input has focus, so it’s not doing anything when it doesn’t have focus.
Here are 3 events. The first puts the count into a text object.
The second uses mod() to check when the length / 5 has a remainder of zero, since mod(0,5) is also true, we ignore that one. It then rotates the object a little just to test the event.
The 3rd event sets the input to nothing if the length equals 10.