Behavior Tutorials
by Fucifer · in Torque Game Builder · 04/02/2007 (1:10 pm) · 4 replies
I am doing the Behavior Tutorials/ Fish Game Tutorial after adding the fishHealthManagement and modifyHealth. When the fish collide with the food or mine, it will disppear never to return. What could be causing this? I have double check everything five times to make sure I code everything accordding to the tutorial.
#2
04/02/2007 (1:58 pm)
The fish is dissapearing. Thanks for helping.
#3
this function:
should really be this:
04/02/2007 (2:08 pm)
That tutorial is something I threw together in the new Doc Builder the day before we released the beta, unfortunately spent most of my time getting the new format working in the Doc Framework and generator so didn't get a chance to go back through it. There is an error in the tutorial...this function:
function fishHealthManagementBehavior::onBehaviorAdd(%this)
{
// calculate the min health
%this.minHealth = %this.maxHealth * 0.20;
// set the max width and height to the starting width and height
%this.maxWidth = %this.getWidth();
%this.maxHeight = %this.getHeight();
// if we are to take damage we must receive collision
%this.owner.setCollisionActive(false, true);
// set a flag to signify that we have health
%this.owner.hasHealth = true;
%this.owner.enableUpdateCallback();
%this.lastSceneTime = 0;
}should really be this:
function fishHealthManagementBehavior::onBehaviorAdd(%this)
{
// calculate the min health
%this.minHealth = %this.maxHealth * 0.20;
// set the max width and height to the starting width and height
%this.maxWidth = %this.owner.getWidth();
%this.maxHeight = %this.owner.getHeight();
// if we are to take damage we must receive collision
%this.owner.setCollisionActive(false, true);
// set a flag to signify that we have health
%this.owner.hasHealth = true;
%this.owner.enableUpdateCallback();
%this.lastSceneTime = 0;
}
#4
04/02/2007 (5:40 pm)
Thanks Matthew, work perfectly.
Torque 3D Owner Matthew Langley
Torque