Join for FREE | Take the Tour Lost Password?
[x]

deviantART

 
About Me Member One who left DA and came back! googleyUnknown Recent Activity Deviant for 6 Years
Needs Premium Membership
Statistics 39 Deviations
8,781 Comments
249,603 Pageviews

12-line Missile Code

Thu Aug 10, 2006, 8:14 PM
Anyone have Flash MX or above? I squashed a tracking script into 12 lines [standard flash syntax] so here's something to try out... :excited:

(preview @ [link])

Open a new document in Flash, press CTRL+J and set the frame rate to 64 fps... press OK. Hit F9 and paste this onto the panel:

_level0.createEmptyMovieClip("r", 0);
var n = r._x = r._y = r._rotation = 50;
r.lineStyle(6, 3234436, 98);
r.curveTo(11.5, -34, 23, 0);
setInterval(function () {
var t = (r._y-_ymouse<0) ? (180-(Math.asin((_xmouse-r._x)/Math.sqrt((_xmouse-r._x)*(_xmouse-r._x)+(r._y-_ymouse)*(r._y-_ymouse)))*180/Math.PI)) : (Math.asin((_xmouse-r._x)/Math.sqrt((_xmouse-r._x)*(_xmouse-r._x)+(r._y-_ymouse)*(r._y-_ymouse)))*180/Math.PI);
r._rotation = (Math.abs(t-r._rotation)<10 || Math.abs(t-r._rotation)>350) ? t : r._rotation;
n = ((Math.abs(t-r._rotation)<10 || Math.abs(t-r._rotation)>350) ? 0 : n)+((r._rotation<t) ? (n<5 ? 1 : 0) : (r._rotation>t ? (n>-5 ? -1 : 0) : 0));
r._rotation += n;
r._x += 4.5*Math.sin(r._rotation*Math.PI/180);
r._y -= 4.5*Math.cos(r._rotation*Math.PI/180);
}, 12);


Press CTRL+ENTER and enjoy :w00t!:

It ain't the best, so rip away!

deviantID

No deviantID yet.

Devious Info

  • Current Residence: Hong Kong
  • Favourite photographer: never knew photographers get famous!
  • Personal Quote: vote 5 ;D

deviantART Community Board

[x]

Webcam

Site Map