Game Development Community

Diminishing number of particles per run

by Thomas Andersson · in Torque Game Builder · 03/18/2007 (4:13 pm) · 0 replies

Hi.

I've recently started goofing off in TGB (again) and was just playing around with the new drag and drop stuff in the editor. I decided to mount a particle effect to a player controlled beast that would give off an effect while a key was held down and stop when it was released. The code below works nicely on the first few runs, but after a few restarts (run game from the editor) the particles start to thin out. Eventually I'm down to no particles at all after about 10-15 restarts.

The particle effect is placed out in the editor and not created / deleted or modified by me in script other than what's in the snippet below (there named "pMonEff"). My editor has been flakey and crashing quite often - so this may just be a bug in the particle system or in the editor interfacing with it.

Does anyone have similar issues or experience with this?

function updatePlayer()
{
	schedule(60, 0, "updatePlayer");
 
	%rot = 0;
	if ( pMon.pressLeft )
		%rot = -pMon.turnSpeed;
	if ( pMon.pressRight )
		%rot += pMon.turnSpeed;
	pMon.setAngularVelocity(%rot);

	%angle = pMon.getRotation();
	if ( pMon.pressUp )
	{
		pMon.setConstantForcePolar(%angle, pMon.accSpeed, true);
		pMonEff.playEffect(false);
	}
	else
	{
		pMon.setConstantForcePolar(%angle, 0, true);
		pMonEff.stopEffect(true, false);
	}
}

edit: It is easy to get this working with spawning the effect by myself in script. I'm wondering if there is a problem with how things work in the editor.