system down
by rennie moffat · in Torque Game Engine · 07/24/2009 (12:49 pm) · 0 replies
///controls playersMovement including mouse event triggers
if (!isObject(PlayerMovementBehavior))
{
%template = new BehaviorTemplate(PlayerMovementBehavior);
%template.friendlyName = "PlayerMovement";
%template.behaviorType = "Input";
%template.description = "controls player movement";
%template.addBehaviorField(xVelocity, "The speed at which the object will move horizontally (world units per second)", float, 5.0);
%template.addBehaviorField(yVelocity, "The speed at which the object will move vertically (world units per second)", float, 5.0);
%template.addBehaviorField(acceleration, "Forward acceleration", float, 10);
%template.addBehaviorField(damping, "Amount to damp movement", float, 5);
}
Hi, I just wrote this script but it has crashed my game. Im not sure why? Anyone?
A quick explanation would do me wonders.
if (!isObject(PlayerMovementBehavior))
{
%template = new BehaviorTemplate(PlayerMovementBehavior);
%template.friendlyName = "PlayerMovement";
%template.behaviorType = "Input";
%template.description = "controls player movement";
%template.addBehaviorField(xVelocity, "The speed at which the object will move horizontally (world units per second)", float, 5.0);
%template.addBehaviorField(yVelocity, "The speed at which the object will move vertically (world units per second)", float, 5.0);
%template.addBehaviorField(acceleration, "Forward acceleration", float, 10);
%template.addBehaviorField(damping, "Amount to damp movement", float, 5);
}
Hi, I just wrote this script but it has crashed my game. Im not sure why? Anyone?
A quick explanation would do me wonders.
function PlayerMovementBehavior::onBehaviorAdd(%this)
{
%this.owner.setUseMouseEvents(true);
}
function PlayerMovementBehavior::onMouseDown(%this, %worldPos)
{
%position = %this.owner.position;
if (%this.moveToPosition)
%position = %worldPos;
%this.object.Player(%position);
%this.owner.linearVelocity = %this.xVelocity SPC %this.yVelocity;
}About the author
My thanks to Garage Games and the Garage Games Community combined with owned determination I got one game up, Temple Racer and I am looking to build more interesting, fun games for the mass market of the iOS app store.