Game Development Community

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

#1
12/27/2006 (8:45 am)
Just to clarify - you did define playerShip something like this right?
new t2dStaticSprite(playerShip);
Or at least you typed playerShip in the Class field in the editor?

Just want to make sure you're using %this correctly
#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
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