How do I make a typing game using construct 2

Get help using Construct 2

Post » Fri Jun 19, 2015 7:15 am

I am trying to make this game that feels a little like the typing maniac game on Facebook a long long time ago. Basically the words will be falling from the top of the screen and the player has to type in the letters in sequence to sort of clear the words. My question will sound very dumb but how do I let the game detect the player text input. Like I don't know how to make it possible for the player to type text in a text box..... After I do that do I compare the player text input with the instance variable on the object or...? Thanks in advance for helping!
B
4
Posts: 4
Reputation: 208

Post » Fri Jun 19, 2015 7:42 am

Keyboard has an "OnAnyKeyPressed" event. Note that this returns a thing called a key code, which isn't the same as a string ; it provides a "String from Key code" function to give you a string.
My tutorial through development blog is at http://myconstruct2dev.blogspot.co.uk/
B
12
S
3
Posts: 221
Reputation: 1,328

Post » Fri Jun 19, 2015 8:32 am

Sorry I'm super new to all this but after getting the text, how do I compare the string that I get to the variable on the text? And when I don't know how to backspace the letters that are typed wrongly...
Thanks for the help!
B
4
Posts: 4
Reputation: 208

Post » Fri Jun 19, 2015 10:21 am

just a thought... TypingGame.capx
Last edited by korbaach on Sat Jun 20, 2015 6:28 pm, edited 1 time in total.
Image
B
65
S
23
G
7
Posts: 1,505
Reputation: 10,896

Post » Fri Jun 19, 2015 2:41 pm

Well, the word you are typing in will have two variables. One is the actual word itself "elephant" (say), the other is the position in the word you are currently at , 4 (say).

This means you want the fourth letter of elephant (the 'p') which you can compare against the letter that you have typed or clicked on.

Note, unlike many BASIC type languages, the mid function counts from zero, so mid("elephant",4,1) is "h" *not* "p" as you might expect (e.g. "e" is index 0,"l" index 1 and so on)
My tutorial through development blog is at http://myconstruct2dev.blogspot.co.uk/
B
12
S
3
Posts: 221
Reputation: 1,328

Post » Mon Sep 11, 2017 6:17 pm

Message: maxGfive can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
guys i'm trying to make a typing game based on the typinggame.capx provided here by korbaach. but 2 problems for me there:

- first, i would like to have every sprite letters disappear one bye one (in the correct order!) if i press the exact key.

because i'm a noob with construct the only expression or formula i managed to find here is to compare the key pressed with "Keyboard.StringFromKeyCode(Keyboard.LastKeyCode)"
and "uppercase(left(txtWord.Text,1))" with the action: destroy sprite.

so with A pressed (conditions: animation frame = 0, and sprite visible on screen) the word "arachnids" will become "rchnids"
so it does take off the first letter but also all A from word :( plus if i continue and press R it will not disappear. i tried to add conditions
"uppercase(left(txtWord.Text,1))"=/= "uppercase(left(txtWord.Text,2))" ...text,3 text,4 etc with no succes. it becomes complicated for me...

- second, if i make a mistake and press b for example nothing happens and if it's a very long sentence i will see the error way too late.
i took the same formula above with action: sound+ right(SpriteFont.Text,len(SpriteFont.Text)-1) to erase the wrong key pressed

but again it works perfectly for first letters but i don't know how to do it for the rest of the word.

it would be nice of you all if you could give me some hints. thanks
hope i didn't choose the worst method possible :p

ps: i don't know if i can allready put links, it's my very first post so.

Image "https://imgur.com/a/8z0dA"

the modified capx: https://ufile.io/d0o5b "https://ufile.io/d0o5b"
B
1
Posts: 2
Reputation: 129

Post » Mon Sep 11, 2017 6:48 pm

Hey @maxGfive!

I adjusted the capx for you. Check the bookmarked block.

https://www.dropbox.com/s/vrv5e2h7v6tro ... .capx?dl=0

Hope it helps. Cheers!
Bruno

I like to eat, but I'm no cook. Why liking to play games would make you a game designer?
B
16
S
4
G
1
Posts: 435
Reputation: 2,353

Post » Mon Sep 11, 2017 7:56 pm

just incredible, i could NEVER figure it out even a little ^^
thank you soooo much.

you rock bruno :)
B
1
Posts: 2
Reputation: 129

Post » Tue Sep 12, 2017 10:30 am

Glad to help, man! Good luck on your project! :)
Bruno

I like to eat, but I'm no cook. Why liking to play games would make you a game designer?
B
16
S
4
G
1
Posts: 435
Reputation: 2,353


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 18 guests