Pluie ou neige par AS 2
Tutoriel vidéo ( patientez durant le chargement )
Action à copier coller
Vous pouvez modifier ceci :
Concerne la quantité de pluie
Concerne la vitesse ( à baisser par exemple pour la neige )
Concerne l' angle de chute

Tutoriel vidéo ( patientez durant le chargement )
Action à copier coller
- Code: Tout sélectionner
//Creating an empty movieclip to attach the clip from library
_root.createEmptyMovieClip("holder", this.getNextHighestDepth());
//settig variables
holder.maxdrops = 200;
//no of drops
var downspeed = 50;
//speed of the drops
var dropslop = 10;
//slop of the drops
//Part 1 attaching the clips with loop
for (i=0; i<holder.maxdrops; i++) {
holder.attachMovie("circleclip", "drop"+i, i+5);
focuseddrop = holder["drop"+i];
focuseddrop.cacheAsBitmap = true;
focuseddrop._x = random(Stage.width);
focuseddrop._y = random(Stage.height);
focuseddrop._yscale = random(100);
focuseddrop._rotation = -dropslop;
}
//part 2 setting an interval for motion of drops
var dropup = setInterval(movedrop, 1);
//function to repeat in the interval
function movedrop() {
for (i=0; i<holder.maxdrops; i++) {
focuseddrop = holder["drop"+i];
focuseddrop._rotation = -dropslop;
focuseddrop._y += 25+downspeed/focuseddrop._yscale;
focuseddrop.x += Math.tan(dropslop);
if (focuseddrop._y>=Stage.height+20) {
focuseddrop._y = random(30);
focuseddrop._x = random(Stage.width);
}
}
}
Vous pouvez modifier ceci :
- Code: Tout sélectionner
holder.maxdrops = 200
Concerne la quantité de pluie
- Code: Tout sélectionner
var downspeed = 50
Concerne la vitesse ( à baisser par exemple pour la neige )
- Code: Tout sélectionner
var dropslop = 10
Concerne l' angle de chute










