Results 1 to 14 of 14
Thread: particle engine 2 - starShip
-
January 19th, 2006, 06:27 PM #1
particle engine 2 - starShip
and another entry by NiñoScript, Hooray!
CONTROLS:
_root._ymouse = affects the speed of the spaceShip;
Key.SPACE = creates a hi gravity point in the middle of the universe (aka blackhole), atracting the stars to it, but in this fake world, stars can scape that atraction after some fighting.[/size]
i hope you like it
edit:
it looks weird when i see it in my browser, maybe becouse of the "noScale", dunno... if u want it to look like it should, just make a new document in flash and paste my code
another edit:
ok, i removed the "noScale" to add it to the forum, now it works ok
Last edited by NiñoScript; January 20th, 2006 at 02:02 PM.
My real name is: Cristián Arenas Ulloa.
Member #1 Of The NiñoScript's Club
Member #4 Of The I Want A Mac Club
Member #7 Of The Kirupa Anime Club
Member #1 Of The Courier Font Club
-
January 19th, 2006, 06:29 PM #2
CODE 'TILL NOW:
Code:Stage.scaleMode = "noScale"; //1 //{speed:{x:0, y:0}, x:Stage.width/2-random(100)+50, y:Stage.height/2-random(100)+50} starArray = [{speed:{x:0, y:0}, x:Stage.width/2-random(100)+50, y:Stage.height/2-random(100)+50}]; //2 function drawStar(p) { _root.change({func:"moveTo", value:[p.p.x-p.old.x*2, p.p.y-p.old.y*2]}).change({func:"lineTo", value:[p.p.x, p.p.y]}); //3 } Object.prototype.change = function(what:Object, who) { /* .change({property:"", value:}) or .change({func:"", value:[]}) */ what.func == undefined ? this[what.property]=what.value : this[what.func](what.value[0], what.value[1]); //4 return !who ? this : who; //5 }; function moveStar(p, i) { p.speed.change({property:"x", value:p.speed.x+Math.cos(Math.atan2(p.y-Stage.height/2, p.x-Stage.width/2))*speed/100}).change({property:"y", value:p.speed.y+Math.sin(Math.atan2(p.y-Stage.height/2, p.x-Stage.width/2))*speed/100}, p).change({property:"oldx", value:p.x}).change({property:"oldy", value:p.y}).change({property:"x", value:p.x>Stage.width+20 or p.x<-20 ? starArray[i]={speed:{x:0, y:0}, x:Stage.width/2-random(100)+50, y:Stage.height/2-random(100)+50} : p.x+p.speed.x}).change({property:"y", value:p.y>Stage.height+20 or p.y<-20 ? starArray[i]={speed:{x:0, y:0}, x:Stage.width/2-random(100)+50, y:Stage.height/2-random(100)+50} : p.y+p.speed.y}); //6 return {old:{x:p.x-p.oldx, y:p.y-p.oldy}, p:p}; //7 } onEnterFrame = function () { speed = Key.isDown(Key.SPACE) ? -150 : _ymouse; //8 starArray.length<30 ? starArray.push({speed:{x:0, y:0}, x:Stage.width/2-random(100)+50, y:Stage.height/2-random(100)+50}) : null; //9 _root.change({func:"clear", value:null}).change({func:"lineStyle", value:[0]}); for (var i = 0; i<starArray.length; i++) { //10 drawStar(moveStar(starArray[i], i)); //11 } };My real name is: Cristián Arenas Ulloa.
Member #1 Of The NiñoScript's Club
Member #4 Of The I Want A Mac Club
Member #7 Of The Kirupa Anime Club
Member #1 Of The Courier Font Club
-
January 19th, 2006, 09:39 PM #36,170iAm t3h hybrid
postsi'm definitely liking this! nice one, ninoscript!
-
January 20th, 2006, 01:50 PM #4
nifty
Member #2 of the "I wont critique Timmytot's designs anymore" club.
-
January 20th, 2006, 02:07 PM #5
now it reacts to the FPS, and the number of lines hasn't changed
that means that in each computer, the number of stars will adapt so the FramesPerSecond dont go down from 36 app
Code:var fps = {variable:0, fps:100, constant:36, starArray:[{speed:{x:0, y:0}, x:Stage.width/2-random(100)+50, y:Stage.height/2-random(100)+50}]}; //1 function drawStar(p) { _root.change({func:"moveTo", value:[p.p.x-p.old.x*2, p.p.y-p.old.y*2]}).change({func:"lineTo", value:[p.p.x, p.p.y]}); //2 } Object.prototype.change = function(what:Object, who) { /* .change({property:"", value:}) or .change({func:"", value:[]}) */ what.func == undefined ? this[what.property]=what.value : this[what.func](what.value[0], what.value[1]); //3 return !who ? this : who; //4 }; function moveStar(p, i) { p.speed.change({property:"x", value:p.speed.x+Math.cos(Math.atan2(p.y-Stage.height/2, p.x-Stage.width/2))*speed/100}).change({property:"y", value:p.speed.y+Math.sin(Math.atan2(p.y-Stage.height/2, p.x-Stage.width/2))*speed/100}, p).change({property:"oldx", value:p.x}).change({property:"oldy", value:p.y}).change({property:"x", value:p.x>Stage.width+20 or p.x<-20 ? (fps.fps<fps.constant*2/3 ? (fps.starArray.splice(i, 1), fps.fps += 2) : (fps.starArray[i]={speed:{x:0, y:0}, x:Stage.width/2-random(100)+50, y:Stage.height/2-random(100)+50})) : p.x+p.speed.x}).change({property:"y", value:p.y>Stage.height+20 or p.y<-20 ? (fps.fps<fps.constant*2/3 ? (fps.starArray.splice(i, 1), fps.fps += 2) : (fps.starArray[i]={speed:{x:0, y:0}, x:Stage.width/2-random(100)+50, y:Stage.height/2-random(100)+50})) : p.y+p.speed.y}); //5 return {old:{x:p.x-p.oldx, y:p.y-p.oldy}, p:p}; //6 } onEnterFrame = function () { fps.fps>fps.constant ? fps.starArray.push({speed:{x:0, y:0}, x:Stage.width/2-random(100)+50, y:Stage.height/2-random(100)+50}) : null; //7 fps.change({property:"variable", value:fps.variable+1}, _root).change({property:"speed", value:Key.isDown(Key.SPACE) ? -150 : _ymouse}).change({func:"clear", value:null}).change({func:"lineStyle", value:[0]}); //8 for (var i = 0; i<fps.starArray.length; i++) { //9 drawStar(moveStar(fps.starArray[i], i)); //10 } }; setInterval(function () { fps.change({property:"fps", value:fps.variable}).change({property:"variable", value:0}); //11 }, 1000); //12?
Last edited by NiñoScript; January 20th, 2006 at 02:09 PM.
My real name is: Cristián Arenas Ulloa.
Member #1 Of The NiñoScript's Club
Member #4 Of The I Want A Mac Club
Member #7 Of The Kirupa Anime Club
Member #1 Of The Courier Font Club
-
January 20th, 2006, 04:29 PM #6
Nice!
nokrev on Adobe and Macromedia:
With the merger, these two great technologies will be merging.
nokrev on this footer:
I love seeing Sinister Shadow's footer.
-
January 20th, 2006, 08:19 PM #7
Mines looks better..
http://www.kirupa.com/forum/showthread.php?t=205315
we used similar concept..
What? My english sucks... well I know that... sorry..
-
January 20th, 2006, 09:53 PM #8
im a copycat,

but, only mine makes you feel like if you were goin' fast
edit: only mine has a black hole in the middle of the universe too
Last edited by NiñoScript; January 21st, 2006 at 10:03 AM.
My real name is: Cristián Arenas Ulloa.
Member #1 Of The NiñoScript's Club
Member #4 Of The I Want A Mac Club
Member #7 Of The Kirupa Anime Club
Member #1 Of The Courier Font Club
-
January 21st, 2006, 06:32 PM #9
bah..
its all for fun for me anywhay..
do your best and good luck..!What? My english sucks... well I know that... sorry..
-
January 21st, 2006, 11:11 PM #10
this two have nothing in common
one is profesional
but why do you have so many vertical and horizontal lines on upper and right edge of SWF file?
-
January 22nd, 2006, 06:58 AM #11i don't know... that's a bug
Originally Posted by gvozden

which one?
Originally Posted by gvozden
My real name is: Cristián Arenas Ulloa.
Member #1 Of The NiñoScript's Club
Member #4 Of The I Want A Mac Club
Member #7 Of The Kirupa Anime Club
Member #1 Of The Courier Font Club
-
January 23rd, 2006, 12:43 PM #128Scripted life it may seem
postswow... nice one.. i dont even know how to use prototype! can some one teach me!!!???
-
January 23rd, 2006, 08:46 PM #13
of course, i can

just pm meMy real name is: Cristián Arenas Ulloa.
Member #1 Of The NiñoScript's Club
Member #4 Of The I Want A Mac Club
Member #7 Of The Kirupa Anime Club
Member #1 Of The Courier Font Club
-
December 31st, 2007, 12:03 AM #14
Similar Threads
-
Best search optimization for flashed site
By wownflutter in forum Flash IDEReplies: 15Last Post: May 22nd, 2010, 05:17 PM -
"The new internet" - do you guys think this is bs?
By von_dragon in forum RandomReplies: 21Last Post: January 19th, 2006, 04:26 AM -
help with lost in beta's particle volcano
By lunatic in forum ActionScript 2 (and Earlier)Replies: 3Last Post: December 31st, 2005, 07:34 PM -
Help with CSS
By jp182 in forum Web (HTML5, CSS, JavaScript)Replies: 4Last Post: November 10th, 2005, 11:36 PM -
Particle Experiments
By Marz in forum RandomReplies: 14Last Post: June 27th, 2005, 12:04 PM

Reply With Quote


Bookmarks