A downloadable tool

Download NowName your own price

๐ŸŽฎ action_On_KeyPress โ€“ CopperCube Plugin

action_On_KeyPress is a lightweight and flexible CopperCube plugin that allows you to trigger any action when a specific key or mouse button is pressed — perfect for creating custom controls, toggles, or interactive gameplay moments without relying on complex behavior chains. This plugin gives you direct control over key-based interactions.

๐Ÿ”ง Plugin Parameters

  • Js_Key_Code (int, default: 40 "Down Arrow"): Keycode of the keyboard key to monitor. When this key is pressed, the Action_On_KeyPress action is executed.
  1. Useful examples: 32 = Space, 13 = Enter, 27 = Esc, 70 = โ€œFโ€, 37/38/39/40 = Left/Up/Right/Down Arrows.
  • Use_Mouse_Button (bool, default: false): Enables mouse click detection.
  1. false: Only the keyboard is detected (via Js_Key_Code).
  2. true: Mouse click detection is detected (see Mouse_Button and mappings).
  • Mouse_Button (string, default: "left"): The "logical" button you want to listen for: "left" or "right". This choice is linked to the raw mappings below (Map_Left_Code, Map_Right_Code) to accommodate OS/mouse differences.
  1. Tip: Leave "left" at the beginning, check the logs to see the codes received, and adjust the mappings. Mine for example is Map_Left_Code = 0, so right = 2.
  • Map_Left_Code (int, default: 1): Expected raw code when Mouse_Button is "left". By default, the CopperCube documentation indicates 1 = left click. If your logs show something else (e.g., 0), add 0 here to match.
  • Map_Right_Code (int, default: 2): Expected raw code when Mouse_Button is "right". By default, the CopperCube documentation indicates 2 = right click. 
  • Action_On_KeyPress (action): The action to perform when the condition is met: either the Js_Key_Code key is pressed, or (if Use_Mouse_Button == true) the mapped mouse click matches.

๐Ÿ•น๏ธ Example Use Case

You can easily integrate this plugin using the "On proximity do something" behavior. On proximity a 2D Overlay is displayed showing the letter "E" indicating the player to press the "E" key to trigger, a dialogue or an action to open, doors or anything. But you are not limited to that, use your imagination.

  • On key press โ†’ trigger action_On_KeyPress to execute your desired action. This setup is ideal for creating responsive gameplay mechanics, toggling UI elements, or activating special effects.

This plugin is free to use and designed to save you time while expanding your creative possibilities in CopperCube. If it helps your project, a small tip is always appreciated. Happy developing! ๐Ÿš€

Download

Download NowName your own price

Click download now to get access to the following files:

action_On_KeyPress.js 3 kB

Development log

Comments

Log in with itch.io to leave a comment.

Super great. This update is what i needed ๐Ÿ˜ƒ 

I needed it too lol ๐Ÿ˜

Awesome!!!, this would be perfect for games with interactive elements

Thanks, glad you find it useful.