rebol [ title: "MX-Translator" type: 'mx file: %mx-translator.swf background: 153.165.139 rate: 24 size: 320x320 author: "Oldes" email: oliva.david@seznam.cz date: 29-09-2003 purpose: {special object for sprites movement} comment: {} ] background 153.165.139 es: EmptySprite shp_circle: Shape [ Bounds -15x-15 15x15 edge [width 3] fill color 255.200.100 circle 10 ] spr_circle: Sprite shp_circle exportAssets [spr_circle "circle"] translator: place es [ actions [ load [ objects: [] _global.maxSteps: 50 ] enterFrame [ for i 0 (objects.length) 1 [ obj: objects/:i telltarget obj [ vx: vx + ((destx - _x) / ac) vy: vy + ((desty - _y) / ac) _x: _x + vx _y: _y + vy steps++ if ((math.abs((desty - _y)) < 1) and (math.abs((lvy - vy)) < 0.01)) or (steps > maxSteps) [ stops: true ] lvx: vx lvy: vy vx: vx * sl vy: vy * sl ;_root.info: vx add "x" add vy add " " add _y ] if obj.stops [ with obj [ vx: 20 - random 40 vy: 20 - random 40 destx: 40 + random 240 desty: 40 + random 240 ac: 30 + random 30 ;sl: 0.85 ;math.abs((math.random() - 0.2)) stops: false steps: 0 ] ] ] ] ] ] doAction [ i: 0 addCircle: func[][ i++ if i = 20 [ clearInterval(intID) ] o: make object! [ _x: 0 _y: 0 destx: 40 + random 240 desty: 40 + random 240 vx: 0 vy: 0 ac: 10 + random 20 ;lower number means faster movement sl: 0.75 steps: 0 ] attachMovie("circle" ("c" add i) (i + 10) o) translator.objects.push((eval(eval("c" add i)))) ] intID: setInterval(addCircle 200) stop ] showFrame end