### Author Topic: Particles  (Read 2249 times)

0 Members and 1 Guest are viewing this topic.

#### Handmixer

• LV2 Member (Next: 40)
• Posts: 21
• Rating: +0/-0
##### Particles
« on: December 12, 2013, 01:41:53 pm »
I made this simple star routine.
The stars are stored in a List (L0), but is there any other way?

Code: [Select]
EXPORT Stars()BEGIN LOCAL XX,YY,ANG,VEL; DIMGROB_P(G1,320,240); L0:={}; REPEAT   XX:=RANDOM(1,319);  YY:=RANDOM(1,239);  FOR I FROM 1 TO 400 STEP 4 DO   L0(I):=XX;   L0(I+1):=YY;   VEL:=RANDOM(0.5,5.0);   ANG:=π*RANDOM(0.0,2.0);   L0(I+2):=VEL*COS(ANG);   L0(I+3):=VEL*SIN(ANG);   END;   RECT_P(G1,#000000);  FOR J FROM 1 TO 50 DO //   RECT_P(G1,#000000);   FOR I FROM 1 TO 400 STEP 4 DO    PIXON_P(G1,L0(I),L0(I+1),#FFFFFF);    PIXON_P(G1,L0(I)+1,L0(I+1),#FFFFFF);    PIXON_P(G1,L0(I),L0(I+1)+1,#FFFFFF);    PIXON_P(G1,L0(I)+1,L0(I+1)+1,#FFFFFF);   END;   BLIT_P(G0,G1);   FOR I FROM 1 TO 400 STEP 4 DO    L0(I):=L0(I)+L0(I+2);    L0(I+1):=L0(I+1)+L0(I+3);    L0(I+3):=L0(I+3)+0.15;   END;  END;  UNTIL ISKEYDOWN(14);END;