Glühwurm in Flash

Ok, ich habs jetzt mit AS2.0 realisiert.
Jetzt noch eine Frage zum Script ich möchte die Glühwürmchen auf einen Bereich von sagen wir 200px hoch und 200px weit eingrenzen wie stelle ich das an ?

Code:
MovieClip.prototype.setzePartikel = function(pIcon, posX, posY, pMax, pMult, pDim)
{		
	for (var i = 0; i < pMax; i++)
	{
		this.bot = this.attachMovie (pIcon, "bot" + (i + 1), i);	
		this.bot.blendMode = "add";
		this.bot._x = posX;
		this.bot._y = posY;		
		this.bot.vx = 0;
		this.bot.vy = 0;
		this.bot.onEnterFrame = bewegung;
		this.bot.onMouseDown = reset;
	}
	function bewegung ()
	{
		this.vx += Math.random () * .6 - .3;
		this.vy += Math.random () * .6 - .3;
		this.vx *= pMult;
		this.vy *= pMult;
		this._x += this.vx;
		this._y += this.vy;
		this._xscale = random (pDim);
		this._yscale = this._xscale;
	}
	function reset ()
	{
		this.vx = (_xmouse - this._x) * .05;
		this.vy = (_ymouse - this._y) * .05;
	}
}
ASSetPropFlags (MovieClip.prototype, "setzePartikel", 1);

this.setzePartikel ("bot", 200, 100, 25, .90, 15);

Mit
Code:
this.setzePartikel ("bot", 200, 100, 25, .90, 15);

habe ich 200px von links 100px von oben den Startpunkt gesetzt, 25 ist die Menge der Würmchen 90 die Verzögerung der Bewegung und 15 die Größe der Würmchen.

Wie setze ich nun noch eine Begrenzung das die Glühwürmchen nur 200px hoch und 200px weite Zufallsberechnet "hin" dürfen, da diese momentan noch aus dem Bild raus laufen :)
 
Zurück