Home Tutorials Forums Articles Blogs Movies Library Employment Press
Home » Actionscripts library »  Math Object

Next 5

Flashstar Bots Function

 Here we have a little function to generate little bots. ///////////////////////////////////////////////////////// //Bots Funktion Version 2.0 //By Matthias Kannengiesser ///////////////////////////////////////////////////////// movieclip.prototype.bot = function (links,rechts,oben,unten) { if (signal == 1) { posx = _x; posy = _y; zufall = random(2); b = _rotation; if (zufall == 0) { zufall = -1; } delta = delta_wert*zufall; b = b+delta; w = (b*Math.PI)/180; new_x = posx+(s*Math.cos(w)); new_y = posy+(s*Math.sin(w)); _rotation = b; if ((new_x>links) && (new_xoben) && (new_y
FS Explosion
 /* Explosions Methoden v1.0 von Matthias Kannengiesser */ Movieclip.prototype.preinit = function (wBereich) { x = Math.sin(_rotation%36)*random(wBereich); y = Math.cos(_rotation%36)*random(wBereich); } Movieclip.prototype.initexpo = function (anzahl) { _x = _root._xmouse; _y = _root._ymouse; for (i=1; i
2 decimal places
 //set number to 2 decimal places //You can set this anywhere in your timeline and use as you need anywhere in your movie. Math.__proto__.dec2 = function (num){ valor = String (Math.round(num * 100) / 100); dot = valor.indexOf("."); if(dot == -1){ valor += ".0"; } temp = valor.split("."); addDecimals = 2 - temp[1].length; for(i=1; i<= addDecimals; i++){ valor += "0"; } return valor; }; a = 0.5; b = 0.8; z = Math.dec2(5);//if you trace thism, z will display "5.00" z = Math.dec2(a + b);//if you trace thism, z will display "1.30" Posted by: LordAlex Leon | website http://www.lordalex.com