ambiera logo

Ambiera Forum

Discussions, Help and Support.

folder icon Ambiera Forum > CopperCube > Help with CopperCube
forum topic indicator Toggle Action on Key Press
person icon
kephazard
Registered User
Quote
2024-05-04 00:54:01

I'm new to game dev and picked up Copper Cube the other day.

I am trying to use "F" to toggle a light on and off. I've tried a variety of things using behaviors and variables but I can only get the action to work once. I suspect the key press behavior is not ending, so it can't detect being pressed again.

I've tried looking this up but I've only really found suggestions requiring coding, but I don't know javascript. My coding experience is limited to very basic Python.

I'd prefer to find a solution without scripting so that I can better understand what is happening for future troubleshooting.

Also, if anyone can explain what's happening under the hood that's causing this issue, that'd be really helpful.

person icon
okeoke
Registered User
Quote
2024-05-04 09:14:54

If you only want to toggle light on and off without any other logic, you can simply use "toggle visibility" to hide unhide the light node.
embedded external image
🔎︎

If you need some more complex logic, like players looks to a switch, and only then it's possible to turn the lights on and off, don't waste your time, and code it with JS:) Your basic python knowledge will be enough - ccb API is actually small and very simple.

person icon
Guest
Guest
Quote
2024-05-04 09:47:19

The reason it only works once is probably because you have the behavior/actions on the node you are setting invisible. This makes it so the behavior doesn't fire again if you press the key because the node is now invisible. Invisible nodes don't utilize their behaviors/actions until made visible again. Try putting the behavior/actions on another node and then set the light node invisible from there. Generally speaking, avoid setting the visibility of a node on the node itself. It should work then.

person icon
kephazard
Registered User
Quote
2024-05-06 14:35:35

Thank you! I didn't realize an invisible node stopped its behaviors. That was exactly the issue.


Create reply:










 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


icon_holyicon_cryicon_devilicon_lookicon_grinicon_kissicon_monkeyicon_hmpf
icon_sadicon_happyicon_smileicon_uhicon_blink   






Copyright© Ambiera e.U. all rights reserved.
Contact | Imprint | Products | Privacy Policy | Terms and Conditions |