Leaf shadow on the ground - is it possible?
by Kostiantyn Teterin · in Torque Game Builder · 10/25/2006 (11:40 am) · 3 replies
Hi!
I need to make a leaf shadow on the ground. I want it to be slowly rotated back and forth on a small angle to simulate the wind. I have tried to make a particle effect to do this, but all I get is a very fast rotation, or the rotation on big angles. Is it possible to make slow rotation (spin) on small angle using particle? If so, then how?
Thanks for your help!
I need to make a leaf shadow on the ground. I want it to be slowly rotated back and forth on a small angle to simulate the wind. I have tried to make a particle effect to do this, but all I get is a very fast rotation, or the rotation on big angles. Is it possible to make slow rotation (spin) on small angle using particle? If so, then how?
Thanks for your help!
About the author
#2
12/13/2006 (2:38 am)
You can create a dynamic shadow using script code. You will have to play with the offset values in the mount part of the shadow to determine where the shadow will display. Also as the animation changes frames the shadow changes also in the onFrameChange event. I am attaching a screenshot alsofunction Bonus::onAdd(%this)
{
%this.diveInEventId = %this.schedule(getRandom(7000,10000),"diveIn");
%this.setBlendAlpha(0);
%this.fadeId = %this.schedule(200,"fadeIn");
%this.bonus_anim = getRandom(1,6);
%anim_name = "gem" @ %this.bonus_anim @ "Animation";
%this.setAnimation(%anim_name);
%this.setUseMouseEvents( true );
%this.type="Bonus";
%this.mouseover=true;
%this.setFrameChangeCallback(true);
[b]
%this.shadow = new t2dAnimatedSprite(){scenegraph = SceneWindow2D.getScenegraph();};
%this.shadow.setAnimation(%this.getAnimation());
%this.shadow.setBlendColor("0 0 0 .2");
%srat = %this.getSizeX()/%this.getSizeY();
%this.shadow.setSizeX(%this.getSizeX()- (%srat * 1) );
%this.shadow.setSizeY(%this.getSizeY()- (%srat * 12));
%this.shadow.setRotation(180);
%this.shadow.mount(%this, 0, 1.03, 0, true,true, true, true); [/b]
alxPlay(gemAppearAudio);
}
function Bonus::onFrameChange(%this,%fi)
{
[b] %this.shadow.setAnimationFrame(%this.getAnimationFrame()); [/b]
}
#3
12/18/2006 (9:57 am)
That is an *incredibly* clever trick for creating shadows. Well done!
Torque Owner Jemand den es nicht gibt