Skip to content

Instantly share code, notes, and snippets.

@tj
Created March 13, 2009 21:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tj/78787 to your computer and use it in GitHub Desktop.
Save tj/78787 to your computer and use it in GitHub Desktop.
# Torque Script
if (!isObject(FollowMouseExBehavior))
{
%template = new BehaviorTemplate(FollowMouseExBehavior);
%template.friendlyName = "Follow Mouse Ex";
%template.behaviorType = "AI";
%template.description = "Set the object to follow the position of the mouse. This version can be " @
"restricted by world limits and will obey collisions.";
%template.addBehaviorField(flipX, "Flip X axis", bool, true);
%template.addBehaviorField(followX, "Follow the mouse's X position", bool, true);
%template.addBehaviorField(followY, "Follow the mouse's Y position", bool, true);
%template.addBehaviorField(trackingSpeed, "The rate at which the object will move toward the mouse", float, 15.0);
}
# Less Lame Torque Script
unless is_object(FollowMouseExBehavior)
:template = new BehaviorTemplate(FollowMouseExBehavior)
:template
.friendly_name = "..."
.behavior_type = "..."
.description = "..."
:template
.add_behavior_field(flip_x, "...", bool, true)
.add_behavior_field(follow_x, "...", bool, true)
.add_behavior_field(follow_x, "...", bool, true)
.add_behavior_field(tracking_speed, "...", float, 15.0)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment