Game Development Community

Error loading particleeffect. Cannot Load-Effect; not in a scene

by Jon Mitchell · in Torque Game Builder · 12/28/2006 (5:00 pm) · 2 replies

I am experimenting with the shooter tutorial, I have only added the movement and fire functions, I am trying to add a jet effect when a directional key is presses. The call from the key being presses is working, but when I try to launch an effect I get an error that I list below. I tried digging around in the forum and best I can tell the way I have set up the function to load the thruster seems to be the same as others I have looked at.

t2dParticleEffect::loadEffect() - Cannot Load-Effect; not in a scene!
test/gameScripts/player.cs (0): Unknown command playAnimation.
Object (2843) t2dParticleEffect -> t2dSceneObject -> SimObject


here is the code I am using
function thruster()
{
	
	%thruster = new t2dParticleEffect() { scenegraph = t2dSceneGraph; };
	%thruster.setPosition(pShip.getLinkPoint("1"));
	%thruster.loadEffect("~/data/particles/jet.eff");
	//%thruster.setLayer(15);
	//%thruster.setSize ("8 4");
	//%thruster.setLifeTime( 0.1 );
	%thruster.playAnimation();
}

Sometimes I make really simple mistakes that can take days for me to pick up on, chasing the missing semi-colon as it were. Does anyone see anything glaringly wrong with how I have set this up?

Thank you!

#1
12/29/2006 (2:50 am)
Try using this for setting the scenegraph

new t2dParticleEffect() { scenegraph = SceneWindow2D.getScenegraph(); };

You are using Playanimation it should be PlayEffect
%thruster.playEffect();

Also you have the function name same as the local variable (thruster). You might want to consider renaming one for clarirty in your code.
#2
12/29/2006 (12:51 pm)
Hi Stanley,
You were right on both counts, thank you very much :)