Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

enter a button combination within time limit

Ugh...  I'll just keep this short okay?

Objective->

To create an event which triggers timer ( that's no problem so far - but here comes the tricky part .. )
where the player has to enter a button combination ( for example up, down, right, left ) within the time limit.
If -> he presses a wrong button -> something bad happens
If -> the time runs out before he's done -> something bad happens
If -> he manages to press the right buttons before the time runs out -> he gets something good


Tried pretty much everything that i could handle myself - conditional branch, set timer, press button.... but it just won't run. A friend thought, maybe it's about switches. I made research about switches, browsed tutorials, but i couldn't understand how those switches work. >_<  Can you give me an example (if it's about switches?) What do they do anyway? And how can i make that time / button enter event work?
 
So you're using key input processing or not? And if so have you set the correct variables. The easiest way would to be to have a timer for each button press, as key input processing is a little finikey.

Basically, you want for each button, your visual prompt, a timer and a key input processing. Then a conditional branch that has the result if key input is right, and if key input is wrong, pretty simple.

If you're having trouble, you can always request a system from xephyr.

Peace
 
Yeah, they way you did it won't work.

Key input processing is more effecient IMO, as it calls a global variable, which mean it can be placed in a seperate event to improve effeciency.

The best example would be my Crono Trigger Minigame sample, which uses key input and a counter. You could potentially use a series of switches and a time limit. ie, up pressed = on & time is under 5 sec. But it could get a little overly complex.

Anyway, here's a download for my mini game, it might give you an idea of where to go from what you've got:

http://www.mediafire.com/?sharekey=0019 ... b9a8902bda

Peace
 
hello and thanks again!  :smile:

i've checked on your example ( late in the evening x.x) - on first sight i couldn't tell how to "tell" the system which button exactly to press -
( it was just the enter button in the example right? ) but was very helpful to me anyway. The switches, have only names, that's all? o.o  ...besides, i'm gonna try to focus more on that mini game at the weekend, maybe i'll find out more  ^^

thank you.
 
I believe it' the 'A' as in the keyboard A. I'll post a better example later this week when I update a few of my event systems and re-release them. Basically, you need to use a combination of switches and input processing.

Peace
 
Thanks Brewmeister & Durastic. 

Gah, your powers united (and examples) helped me understand this a little moar.
I still feel kinda stupid since i can't find out how to tell the switch to... do what i want ( like check a certain button )
but the timer setting alone was a great help.


@Brewmeister 's example

The up down left right button combination worked indeed - and i see why there are numbers for the directional arrows,
yet, i couldn't find a way to change those numbers to keyboard letters. ( it always asks me to enter a number )
 
Yes, each key has a number associated with it.
also, the game refers to the keys ABCXYZLR,
Which are actually ZXCASDQW on the keyboard.
(explained in the help doc under "Game Controls")

A (Z, Shift) = 11
B (X, Esc) = 12
C (C, Space, Enter) = 13
X (A) = 14
Y (S) = 15
Z (D) = 16
L (Q) = 17
R (W) = 18
 
Gah, your powers united (and examples) helped me understand this a little moar.
I still feel kinda stupid since i can't find out how to tell the switch to... do what i want ( like check a certain button )
but the timer setting alone was a great help.

The best way to approach this is to break each process of the minigame into seperate events. Set up an event to check for button presses, an event to check when the correct combination has been pressed, and an event to handle success and failure.

Here's an example from my current event system (WIP) of what I mean:

http://i3.photobucket.com/albums/y87/Du ... xample.png[/img]

As you can see,displaying the attack menu (refered to as menu in my picture), is broken up into 3 sections. One shows the corresponding menu image based on the currently selected item. The Menu Control event records input and changes the option variable accordingly, and Menu options leads into the instructions for each option.

By building it a piece at a time, you'll find it easier to locate problems and insert new feature. It also reduces lag in alot of cases as you don't have hundreds of nestled branches.

Also, for dectecing button imput, there is a third option:

Input.press?(Input::X)

use that under conditional branch > script, and assign the control you watn to check for (so X is atually A on the keyboard >_<)

This system is a little more straightfoward, and if you don't need to check the input in several places at once, this works nicely.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top