How do I disable player input for a moment?(Menu Problem)

Get help using Construct 2

Post » Tue Aug 19, 2014 12:08 am

Hello, this is my first post in this wonderful community.
I'm a musician trying to get into game design.
I don't know how to code but I'm good with game logic.
My favourite game genre is RPG, so I've started to make an RPG battle system in Construct for practice
(and who knows, might use it someday)
The system will be similar to Final Fantasy I and II (Turn Based).

I've started this project two days ago, and it's amazing how far it has come in such a short time.
I've got many things to tackle yet but for now I seem to have a very silly problem...

Well, when the battle starts, the game makes a window that holds the first battler's command information.
The player can select the command they want using the UP and DOWN keys on the keyboard (a cursor moves indicating the command),

Here is what normally needs to happen...
when you select a command, let's say "Attack",
the cursor moves to the enemy's graphic on the battlefield, and a window appears, with the name of the enemy on it. If the player presses A again, they have selected Partymember_1's action (If there are more party members they will have to select actions for them too if not, command phase has ended, and action phase begins).

While I have managed to make all the above stuff, something weird happens with the input.
The player doesn't have the time to press A to select a target, because the A key is pressed before...
I don't know how to explain this better...It's quite tricky...

The player is suppossed to press A twice, once to select "Attack" and twice to select the enemy they want to
attack.

But because the player pressed A to select attack, and the event condition is [When cursor is overlapping enemy1 and the A key is pressed] the game selects the target on its own...

So, is there a way to disable the keyboard just for a moment?
Maybe there is another solution I can't think of?

Any help would be welcome.
Thanks!
B
3
Posts: 9
Reputation: 179

Post » Tue Aug 19, 2014 12:58 am

Welcome to the forum! I too am a musician pretending to be a game developer.

Posting a capx will always get you better/faster help, but I'll take a stab and say try adding a "trigger once while true" event to that A button pressing stuff..

I'd also recommend doing something other than this for your first project, particularly the tutorials and examples that come with C2.

Good luck!
B
86
S
43
G
71
Posts: 601
Reputation: 43,619

Post » Tue Aug 19, 2014 9:27 am

Hello,I see, I'll try your suggestion!
Well, I 've made some other smaller games to get the hang of thr engine, one of them is really good
and I'm thinking of adding in app purchases and releasing it.
I've also have a lot of experience with events from using RPG Maker for 10 years...hehe!
The thing I don't know is to use any kind of real programming...
B
3
Posts: 9
Reputation: 179

Post » Tue Aug 19, 2014 11:43 am

Well, I've tried using trigger once but it's still the same.
How can I upload the capx?
B
3
Posts: 9
Reputation: 179

Post » Tue Aug 19, 2014 12:10 pm

You can, when clicking on the "Full Editor" button attach your capx to your message.
Otherwise you can use a file hosting service like dropbox or google drive and paste the public link in a message.

Your issue is what is called "Finished State Machine".
You need to let your code know exactly what is the current "state" of the action.

Remember the events are executed from top to bottom in your event sheet. And the whole event sheet is read/executed once every tick.

So if you have several events "Player presses A" in your event sheet, you need to add more condition to make sure they won't execute at the "same time".
They will already execute one after the other, in the order of the event sheet, but you also need to make sure that they are executing at the correct time in your game's action.

So for example, you can add a variable (global or instance, this depends on your game) that will allow you to know in what state you currently are.

I attached an example capx to this post, I hope it helps you grab the concept of finished state.

The "Question" variable allows to "separate" the "response" within a single "On any key pressed" event.
In that specific example, the solution is to use the system "Else" condition. But according to your own project, the solution might be to use a delay before changing the value of the variable, for example with a system Wait action.

For that, and as mentioned previously, it would be simpler for us to see your capx to let your know.

I hope this helps.
You do not have the required permissions to view the files attached to this post.
New to Construct ? Where to start

Image Image

Image Image

Please attach a capx to any help request or bug report !
Moderator
B
288
S
111
G
94
Posts: 7,332
Reputation: 69,160

Post » Tue Aug 19, 2014 2:40 pm

Well, I can't open the file because I'm using an older version (Does Construct auto-update by the way?) but I'll check it out as soon as I can.
I've thought of a way of managing this but it feels a bit weird.
I've made a variable called "TargetingMode" and set it to 0 (Off).
When the player presses the A button on attack, the variable changes to 1(on).
Before that, I've added a wait action of 0.4...So it waits a bit before enabling it.
It now works, but feels kind of strange.Also if you press S (cancel) and A (accept) quickly sometimes
it will act like before...
I think I understand what you are saying...I'll have to look at the capx though...

Oh, I forgot here is a link to my capx
(I have the character's sprite to flip as a way to know when the action is activated.
https:// u3mzy2a/ TurnBasedBattleSystemDemo.capx
(Remove the blank spaces)

EDIT-
Ok I had made a silly mistake on the previous capx file!
It works good now. I've managed to solve it using the wait command...
It still feels a bit weird but maybe it's just me!
B
3
Posts: 9
Reputation: 179

Post » Fri Aug 22, 2014 12:47 am

@zero50 Construct 2 does not auto update. But if you come download the most recent version on the website, it will uninstall the old version and just keep the new one if you'd like.
B
13
S
5
G
1
Posts: 119
Reputation: 2,292


Return to How do I....?

Who is online

Users browsing this forum: eochranek, Unconnected and 17 guests