Game Development Community

Disabling Behaviours/Behaviour API?

by Jake Seigel · in Torque Game Builder · 03/10/2008 (1:47 pm) · 3 replies

Hey there, first of all is there an API doc that includes behaviours?

Secondly; is there a disable or pause function for them? I have a case where i'd like to be able to shut them off in code and then activate them later.

#1
04/11/2008 (2:13 pm)
No responses yet? i'd really like to find this out too

Specifically, i've made a simple recording/playback system that records where the player's mouse moves and then plays it back. Technically, i play back the positions of an object with the behavior follow mouse. Records fine but when i play it back it flickers because the object tries to run to where my cursor is and then moves to where i told it to go, causing it to bounce around. So during playback i'd like to turn off the follow mouse behavior and then turn it back on afterwards

A note - this only applies to Follow Mouse Ex, which moves towards the mouse at a given speed. The normal Follow Mouse, which is always at the mouse position, works fine
#2
04/11/2008 (2:42 pm)
You know, in case this question isn't answered or there's no way to do this, i made a new version of the behavior i cared about and added a property Enabled. Now in my code i can just call %someObject.setFollowMouseEnabled(false) and it turns off
#3
04/11/2008 (3:54 pm)
Hi, I think you will have to program that yourself. I use the existing behaviors as an inspiration and program my own. There is a lot of limitations and poorly written code (like enabling update-callback w.o. ensuring that it is turned off agin etc.) in the existing behaviors, hopefully they evolve !
#4
04/11/2008 (4:34 pm)
Hey there,
Baylor: in my code i ended up just putting in my own switch as well for a quick fix. I plan on changing it later to a "better" solution though.
As for disabling the behaviours, if memory serves me you could do it in a class for whatever "object" you have using the behaviour if you wanted to. For example, you'd get the specific behaviour to stop it using:
%behav = %this.getBehavior( "MyAwesomeBehaviour" );