Set size and collision for a particle effect...
by Isaac Barbosa · in Torque Game Builder · 12/29/2006 (5:07 pm) · 6 replies
I'm using this code to attach a particle effect in the stage and it works, except for the size... is there a way to set the size of a particle just like with an static particle? I read the docs but can't find an answer.
And, how can I make my effect to check for collisions?
I have this from the docs... but is not clear for me.
Thanks in advance
function Bomb::bombexplode(%this)
{
%bombexplosion = new t2dParticleEffect()
{
scenegraph = %this.scenegraph;
};
%bombexplosion.loadEffect("~/data/particles/firexplosion.eff");
%bombexplosion.setEffectLifeMode("KILL", 1);
//%bombexplosion.setEffectSize(%this, "1 1");
%bombexplosion.setEffectCollisionStatus(true);
%bombexplosion.setPosition(%this.getPosition());
%bombexplosion.setEmitterType(%this, "Area");
%bombexplosion.setSize(2, 2);
%bombexplosion.playEffect();
}And, how can I make my effect to check for collisions?
I have this from the docs... but is not clear for me.
function Bomb::onParticleCollision( %this )
{
}Thanks in advance
#2
Thanks Drew. I believe I did not explain well my self. I know how to change the size using the particle editor. I want to change the area/size of the whole effect in the game but setSize or size doesn't seems to work.
12/30/2006 (8:22 am)
@Drew:Thanks Drew. I believe I did not explain well my self. I know how to change the size using the particle editor. I want to change the area/size of the whole effect in the game but setSize or size doesn't seems to work.
#3
Thanks for the help...
12/30/2006 (5:49 pm)
How can I set an staticSprite to detect collision against an AnimatedSprite??? Can't find a solution and I have read the whole docs :( Thanks for the help...
#4
Since the onParticleCollision(%this) method has no the %srcObj and the %dstObj methods... how can I be able to make a contact between a playing effect (maybe fire) and my character to make it get burn?
12/31/2006 (9:05 am)
Still can't do it :(Since the onParticleCollision(%this) method has no the %srcObj and the %dstObj methods... how can I be able to make a contact between a playing effect (maybe fire) and my character to make it get burn?
#5
Since the onParticleCollision(%this) method has no the %srcObj and the %dstObj methods... how can I be able to make a contact between a playing effect (maybe fire) and my character to make it get burn?
12/31/2006 (9:30 am)
Still can't do it :(Since the onParticleCollision(%this) method has no the %srcObj and the %dstObj methods... how can I be able to make a contact between a playing effect (maybe fire) and my character to make it get burn?
#6
12/31/2006 (12:51 pm)
Quote:They are both t2dSceneObjects - in terms of collisions you don't need to consider them to be different types of objects, since they both share the same properties when it comes to collisions. Just look up the collision routines in the t2dSceneObject reference or use the collisions feature tutorial.
How can I set an staticSprite to detect collision against an AnimatedSprite??? Can't find a solution and I have read the whole docs :(
Quote:I have to admit, looking at the onParticleCollision callback, it's not very useful to anything but the particle effect. So in your case if you had a particle effect and you wanted to know if your player hit it, then you should create a bounding box around the particle effect that is the same size as the extent of the effect, probably a bit smaller so that when the player comes within range of the effect, a normal onCollision callback is thrown.
Since the onParticleCollision(%this) method has no the %srcObj and the %dstObj methods... how can I be able to make a contact between a playing effect (maybe fire) and my character to make it get burn?
Torque Owner Drew -Gaiiden- Sikora