Input Buffer for CopperCube
A downloadable asset pack
The Input Buffer extension for CopperCube allows you to track the last six key presses and store them in a buffer. It is designed to work with key sequences, enabling the creation of complex combinations and triggers in gameplay.
This package includes:
-
behavior_InputBuffer
, which manages the input buffer, updates it, and synchronizes it with global variables. -
behavior_InputBufferPress
andaction_InputBufferPress
, which check key sequences and trigger an action if a combination matches. -
action_InputBufferClean
, which allows manual buffer clearing.
How It Works
-
Input Buffer (
behavior_InputBuffer
)-
Stores the last six key presses.
-
When a new key is pressed, the oldest entry is removed, and the new one is added at the end.
-
Automatically clears the oldest value at a set interval (
TimeMS
). -
Writes each key press to global variables (
inputBuffer.key_1
—inputBuffer.key_6
), which can be used in game logic.
-
-
Sequence Matching (
behavior_InputBufferPress
andaction_InputBufferPress
)-
Compares the buffer content with a predefined sequence (
Key1
—Key6
). -
If the sequence matches, it triggers a specified action (
Action
). -
Difference between behavior and action:
-
behavior_InputBufferPress
checks for sequences continuously, reacting to buffer changes. -
action_InputBufferPress
checks for sequences only when executed, making it useful for on-demand verification (e.g., when a button is pressed).
-
-
-
Buffer Clearing (
action_InputBufferClean
)-
Resets all buffer values back to
"empty"
. -
Useful after successfully entering a sequence or when you need to manually clear the input history.
-
Use Cases in Games
-
Cheat codes and secrets: Players can enter key combinations to unlock bonuses, secret levels, or activate cheats.
-
Attack combos and movement sequences: Useful for fighting games or action titles where players execute special moves through key sequences.
-
Mini-games: Implement mechanics based on quick input sequences (e.g., lockpicking, entering security codes).
-
Access control systems: Use key combinations to open doors or input passwords.
-
Custom control schemes: Assign special commands to specific key sequences.
Supported Keys
To enter key sequences in the CopperCube editor, use the following values:
Number Keys (0-9)
VK_0
, VK_1
, VK_2
, VK_3
, VK_4
, VK_5
, VK_6
, VK_7
, VK_8
, VK_9
Additional Symbols
VK_MINUS
(minus), VK_PLUS
(plus)
Letter Keys (A-Z)
VK_A
, VK_B
, VK_C
, VK_D
, VK_E
, VK_F
, VK_G
, VK_H
, VK_I
, VK_J
,
VK_K
, VK_L
, VK_M
, VK_N
, VK_O
, VK_P
, VK_Q
, VK_R
, VK_S
, VK_T
,
VK_U
, VK_V
, VK_W
, VK_X
, VK_Y
, VK_Z
Function Keys (F1-F12)
VK_F1
, VK_F2
, VK_F3
, VK_F4
, VK_F5
, VK_F6
, VK_F7
, VK_F8
,
VK_F9
, VK_F10
, VK_F11
, VK_F12
System Keys
VK_ESCAPE
(Esc), VK_TILDE
(~), VK_TAB
, VK_BACKSPACE
, VK_ENTER
Modifier Keys (Shift, Ctrl, Alt)
VK_LSHIFT
(Left Shift), VK_RSHIFT
(Right Shift),
VK_LCTRL
(Left Ctrl), VK_RCTRL
(Right Ctrl),
VK_LALT
(Left Alt), VK_RALT
(Right Alt)
Navigation Keys
VK_CAPSLOCK
(Caps Lock), VK_SPACE
(Spacebar),
VK_PAGE_UP
(Page Up), VK_PAGE_DOWN
(Page Down), VK_END
, VK_HOME
Arrow and Editing Keys
VK_LEFT
(←), VK_UP
(↑), VK_RIGHT
(→), VK_DOWN
(↓),
VK_INSERT
(Insert), VK_DELETE
(Delete)
NumPad Keys (Numeric Keypad)
VK_NUMPAD0
, VK_NUMPAD1
, VK_NUMPAD2
, VK_NUMPAD3
, VK_NUMPAD4
,
VK_NUMPAD5
, VK_NUMPAD6
, VK_NUMPAD7
, VK_NUMPAD8
, VK_NUMPAD9
NumPad Operations
VK_NUMPAD_MUL
(*), VK_NUMPAD_ADD
(+), VK_NUMPAD_SUB
(-),
VK_NUMPAD_DEC
(.), VK_NUMPAD_DIV
(/)
Other Keys
VK_NUMLOCK
(Num Lock), VK_SCROLLLOCK
(Scroll Lock),
VK_PRINTSCREEN
(Print Screen), VK_PAUSE
(Pause)
Conclusion
The Input Buffer extension provides a powerful tool for handling key sequences in CopperCube. You can use it to create secret combinations, complex gameplay mechanics, custom controls, and more.
Use behavior_InputBufferPress
for continuous sequence detection, and action_InputBufferPress
for on-demand verification when needed.
With flexible settings and a wide range of supported keys, this extension unlocks new possibilities for interactive control in CopperCube games.
Published | 5 days ago |
Status | Released |
Category | Assets |
Rating | Rated 5.0 out of 5 stars (1 total ratings) |
Author | SamGrady |
Tags | ambiera, buffer, coppercube, gamedev, input, inputbuffer, samgrady |
Development log
- inputBufferClean HOTFIX4 days ago
Comments
Log in with itch.io to leave a comment.
So in case I want to press the Up,Up,Up 3 times where upon pressing each Up, I want a UI corresponding to each UP pressed to become visible, how do I achieve that?
Also, how can I make the UI invisible if player is not quick enough to press the buttons in succession
"So in case I want to press the Up,Up,Up 3 times where upon pressing each Up, I want a UI corresponding to each UP pressed to become visible, how do I achieve that?" - Since this works as a buffer, just do three checks using
InputBufferPress
. IfVK_UP
is pressed once, trigger one action; if pressed twice, trigger another; and if pressed three times, trigger a third action.As for "Also, how can I make the UI invisible if the player is not quick enough to press the buttons in succession?", that’s a less standard situation. You’ll need to build the logic yourself depending on how you handle the UI and its visibility triggers.
how do I do the check,,if a variable Inputpressbuffer is equal to what? do something
Alright, I’ve run into two problems - first, I have no idea what you’re talking about right now, and second, I forgot to remove the automatic buffer clearing in the code… Gonna update the project files now
Oh ok, i mean how do i perform the check?
Use "Input Buffer Press" Action/Behavior
yes
Cool
Great job