Get a particle to display
by Harrison Brock · in Torque Game Builder · 12/27/2006 (6:57 am) · 5 replies
Here is the function I have wrote to place a shield on a player ship when a key is press down.
function playerShip::shieldOn(%this)
{
%shield = new t2dParticleEffect()
{
scenegraph = %this.scenegraph;
};
%shield.loadEffect("~/data/particles/shield.eff");
%shield.mount(%this);
%shield.setPosition(%this.getPosition());
%shield.playEffect();
%this.shield = %shield;
}
moveMap.bindCmd(keyboard, "f","playerShip.shieldOn();" playerShip.shieldOff();");
But the particle will not display. Could someone help me on this?
Harrison
function playerShip::shieldOn(%this)
{
%shield = new t2dParticleEffect()
{
scenegraph = %this.scenegraph;
};
%shield.loadEffect("~/data/particles/shield.eff");
%shield.mount(%this);
%shield.setPosition(%this.getPosition());
%shield.playEffect();
%this.shield = %shield;
}
moveMap.bindCmd(keyboard, "f","playerShip.shieldOn();" playerShip.shieldOff();");
But the particle will not display. Could someone help me on this?
Harrison
#2
12/27/2006 (12:34 pm)
Yea playerShip is the class name that I set in the editor and pShip is the object name that I set in the editor
#3
Hope that's all it was ;)
12/27/2006 (1:13 pm)
Unless you have specifically defined scenegraph as a dynamic variable on the playerShip, this:scenegraph = %this.scenegraph;should be:
scenegraph = %this.getScenegraph();
Hope that's all it was ;)
#4
12/29/2006 (4:35 pm)
Yea that was going to be my next guess as well
#5
12/29/2006 (10:43 pm)
Thanks
Torque Owner Drew -Gaiiden- Sikora
Or at least you typed playerShip in the Class field in the editor?
Just want to make sure you're using %this correctly