Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperCube > Help with CopperCube
How to active/inactive behaviors?

Alireza
Guest
Quote
2021-01-19 21:47:34

Hi
I want to dynamically enable some of the behaviors of a node and deactivate some without deleting the behaviors.


Robo
Guest
Quote
2021-01-20 00:21:48

You can of course use variables that check for a certain figure every time the behavior runs but even better is to use Actions that only run when needed then stop - more efficient this way.

You can convert many behaviors into Actions that just do a certain thing. Things like keyboard/mouse inputs should be left as a behavior to check all the time though.


Alireza
Guest
Quote
2021-01-20 04:39:18

Thank you dear Robo
For example, I want to give "2d simple jump and run" behavior to a node that has different speeds in different situations. I have to set several "2d simple jump..." behaviors at different speeds, each of which can be activated or deactivated as needed. Is such a thing possible?


Robo
Guest
Quote
2021-01-20 05:27:14

You wouldn't want to activate different behaviors when you can just edit and keep just the one running only.

in the extension you mentioned - if its from my download link then add this to lines 50 & 51:

var speed = ccbGetCopperCubeVariable("speed");
this.speed = speed;

then delete line 8 - if the speed you want to change is that figure only and not the jump speed.

then create your own coppercube variable called "speed".
Have this to have a default value before starting and then you just change this variable as needed....it will check each time for an updated speed value.


copercube+pro
Registered User
Quote
2021-01-20 07:43:59

https://www.ambiera.com/forum.php?t=8692


Alireza
Guest
Quote
2021-01-20 08:02:07

Tanks a lot again.
This is a great method that solves many of my problems. Is this method useful for all extensions and plugins? Wherever I want to change the extensions variables, can I use this method?


Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "Internationa?" (you are not logged in)


Text:

 

  

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


   






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