Game Development Community

Fish Behavior Tutorial

by Craig Griffiths · in Torque Game Builder · 06/10/2009 (10:54 am) · 1 replies

I got through the entire thing and when I go to run it my mines and bubbles just hang there. The only way I can get them to go down is by putting in a y value in the physics tab. When the fish goes to hit the bubbles nothing happens, he hits something since he cant pass through the bubbles. I've looked in console and no script errors and I put in echos in all the modifyHealth behavior functions and nothing shows up in console. I thought something was wrong with my code and maybe made a typo somewhere so I copied the code in the documentation into it and still having the same problem. I looked more up in console and its saying "Some error context, with ## on the sides of error halt" and shows these 3 functions function fishModifyHealthBehavior::onCollision(%this, %dstObj, %srcRef, %dstRef, %time, %normal, %contacts, %

points)
{
echo("collision");
// lets update the health of the object we are colliding with
if(%dstObj.hasHealth)
{
%dstObj.updateHealth(%this.healthModifier);
%this.respawn();
}
}

function fishModifyHealthBehavior::onWorldLimitt2dSceneObject::onWorldLimit(%this, %limitMode, %limit)(%this, %

mode, %limit)
{ echo("limit");
switch$(%limit)
{
case "bottom":
%this.respawn();
}
}

function fishModifyHealthBehavior::respawn(%this)
{ echo("respawn");
%this.owner.setPositionY(%this.startPositionY);
%this.owner.setLinearVelocityY(getRandom(%this.minSpeed, %this.maxSpeed));
}
and now its saying that when i call respawn in onAddToScene its an unknown command. Thanks

#1
06/11/2009 (1:14 pm)
Where do the ## signs pop up in the console?