«

»

Sep 01

Game Programming (swishmax 4) – Retro Star Field – advanced

Advanced retro starfield
Example:

Step.1
add the following script to Scene_1.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
onFrame (1) {
// starfield
    i=0; 
    _x=275; 
    _y=200;
     m=Math; onEnterFrame=function(){     
         star=createEmptyMovieClip("star"+i,++i);     
         star.lineStyle(2,0xFFFFFF);     
         star.lineTo(1,0);     
         star._alpha=0;     
         star.d=1;     
         star.r=m.random()*m.PI*2;     
         star.onEnterFrame=function(){  
             StarCol = Math.round( Math.random()*0xFFFFFF );
             StarColoredObject = new Color (star);
             StarColoredObject.setRGB(StarCol);       
             with(this){             
                 d*=1.1;             
                 if(d>300)removeMovieClip();             
                 _alpha=d/2;             
                 _x=m.cos(r)*d;             
                 _y=m.sin(r)*d;         
                 }     
} 
} 
// 
}

black background, export swf 8.

VN:F [1.9.22_1171]
Rating: 5.0/5 (1 vote cast)
VN:F [1.9.22_1171]
Rating: +1 (from 1 vote)
Game Programming (swishmax 4) – Retro Star Field – advanced, 5.0 out of 5 based on 1 rating

Leave a Reply

6 visitors online now
2 guests, 3 bots, 1 members
Max visitors today: 10 at 02:47 am UTC
This month: 27 at 05-17-2013 01:24 pm UTC
This year: 39 at 01-01-2013 12:46 pm UTC
All time: 109 at 12-07-2012 11:00 pm UTC