Server-monitor.as

From Organic Design wiki
Revision as of 02:05, 20 March 2006 by Rob (talk | contribs) (add actionscript)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

// Instantiate the ball from classes supplied by swf.php attachMovie( 'triangle', 'ball', 1 );

// Set ball scale & colour ball._xscale = ball._yscale = 50; col = new Color( ball ); col.setTransform( { rb:0x22, gb:0xff, bb:0 } );

// Initialise dynamics x = 0.0; y = 0.0; vx = 2.0; vy = 0.0; mx = 2.0; my = 12.0;

// Dynamics (called each frame) function reduce() { x += vx; y += vy; vy += 0.5; if ( vy > my ) vy = my; if ( x < 0 ) { x = 0; vx = mx; } if ( x > 200 ) { x = 200.0; vx = -mx; } if ( y > 200 ) { vy = -my; y = 200.0; } ball._x = x; ball._y = y; ball._rotation += vx*2; }