Press key trigger problem

Hello everybody!

I've been running tests to make a course with a feeling of a game, more interactive and fun. I want a character to walk through a scenario, and after watching many helpful tutorials and gathering a bunch of inspiration from the community, I started the test and now it's stuck.

The character must walk when the user presses the right key - it's a gif animation, moving through a motion path animation, triggered by the key pressing. 

However, if the user keeps the button pressed, the character wont stop walking, and eventually will leave the slide! Is there any way to "block" the movement in case the right button is pressed for a longer time?

I've uploaded the file with the problem, I hope it can clarify a little bit!


Thanks in advance :)

7 Replies
Alyssa Gomez

Hi Marina! 

I really like the design of your slide – nice work!

I haven't seen a way to prevent the character from moving off of the slide if the learner presses the Right key too many times, but perhaps folks in the community can share their experience with this! I'm interested to see the ideas they'll offer. 😁

Marina Dantas

I see the character doesn't leave the slide anymore, which helps me a lot already, thank you! :)

The thing now is, if the user presses the right key repeatedly or just keep the finger holding down the key, the character will "run" to the end of the slide now, and the animation won't be fully played. Any ideas on how to solve this part?

Michael Hinze

See attached a slightly different version that also accounts for the situation when a user keeps the key pressed. I use variables to indicated when the key is pressed, when the animation is complete and when the right edge of the screen is reached. Based on these variables I stop the animation and change the character state.