How do I disable buttons or action while actions are playing

Just started using Construct 2? Post your questions here

Post » Thu Jun 30, 2016 11:55 pm

Hello all! I have a beginner question. I can't get this to work properly. Basically I want a black UI and text to show up when the player presses a button. I want it to stay on screen for a few seconds while the text comes up typewriter style. I have these parts working (well, still working on the typewriter effect but I'm working on it) but I don't want the player to be able to spam the select button making the text/UI visible and invisible after the code runs once. I want the text and UI to display for the appropriate amount and for the player to not be able to press or activate this action again until it finishes playing. Here's my code.

I also have another, more complicated question related to this. I want to create a number of different texts or dialogues that would show up whenever the player presses Select or R. Kind of like a Metal Gear Solid codec system. I know how I would go about making the game say the same specific text/sentence over and over but how would I go about playing 20 different short sentences each time you press select? I'm still new to this and it's hard wrapping my head around arrays and families. That what I need to use, right? Thanks everyone!

Image
Image
B
30
S
15
G
22
Posts: 183
Reputation: 14,221

Post » Fri Jul 01, 2016 12:53 am

You've got the right idea, just backwards. You need to Deactivate the group when the button is pressed, and Activate it after the Wait.
For the array, just use a global variable for the index, and increment it each time it's used. Check against the end of the array to loop it back to zero.
ImageImageImage
B
71
S
22
G
259
Posts: 3,794
Reputation: 143,704

Post » Fri Jul 01, 2016 7:48 am

Thanks for your help blackhornet! Did what you suggested and got it working! Simplified the code too! I had no idea about that I could specifically deactivate different "systems" or code if I put them into groups. Seems like it could be very useful. Here's the bit of code for posterity's sake. Now I'm going to try and get this array working.

Image
B
30
S
15
G
22
Posts: 183
Reputation: 14,221


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 2 guests