Hello everyone
This is my fist time using this Forum. I have just completed the tutorial Falling Snow for Flash CS4/AS3 and actually replaced the flakes for leaves. For the most part the leaves seam to fall perfectly except for the some that are falling to slow. I want to make them fall more quickly. I think I need to change the variables in the Action Script but I am just not sure where and what to change. Please Help!
here is my code:
package
{
import flash.display.;
import flash.events.;
public class leaf extends MovieClip
{
private var xPos:Number = 0;
private var yPos:Number = 0;
private var xSpeed:Number = 0;
private var ySpeed:Number = 0;
private var radius:Number = 0;
private var scale:Number = 0;
private var alphaValue:Number = 0;
private var maxHeight:Number = 0;
private var maxWidth:Number = 0;
public function leaf()
{
SetInitialProperties();
}
public function SetInitialProperties()
{
//Setting the various parameters that need tweaking
xSpeed = .05 + Math.random()*.1;
ySpeed = .5 + Math.random()*3;
radius = .5 + Math.random()*2;
scale = .5 + Math.random();
alphaValue = .5 + Math.random();
var stageObject:Stage = this.stage as Stage;
maxWidth = stageObject.stageWidth;
maxHeight = stageObject.stageHeight;
this.x = Math.random()*maxWidth;
this.y = Math.random()*maxHeight;
xPos = this.x;
yPos = this.y;
this.scaleX = this.scaleY = scale;
this.alpha = alphaValue;
this.addEventListener(Event.ENTER_FRAME, Moveleaf);
}
function Moveleaf(e:Event)
{
xPos += xSpeed;
yPos += ySpeed;
this.x += radius*Math.cos(xPos);
this.y += ySpeed;
if (this.y - this.height > maxHeight)
{
this.y = -10 - this.height;
this.x = Math.random()*maxWidth;
}
this.rotation += xSpeed;
}
}
}