Here's mine. Tutorial I got from Hugo Elias. Thanks Antoni!!! The site is a goldmine!!!!
Antoni.. Yeah, I'll prolly do some Metaballs with it. ;*)
*Think Plasma inside Blobs...
I'll try to add the gel algo laterz...If I can. LOL
Code:
DECLARE SUB AF.Print (Layer%, offs%, Xpos%, Ypos%, text$, col%)
DECLARE SUB Rel.KgenFont (Layer%, offs%, X%, Y%, Font$, MinColor%, Italic%)
DECLARE SUB Grad (col1%, r1%, g1%, b1%, col2%, r2%, g2%, b2%)
DEFINT A-Z
'$DYNAMIC
RANDOMIZE TIMER
DIM Vpage1%(32001)
DIM Vpage2%(32001)
DIM cmap%(255)
DIM div5%(255 * 5)
DIM Lsin(-10 TO 370) AS SINGLE
DIM Lcos(-10 TO 370) AS SINGLE
DIM SHARED Ly&(199)
DIM textX%(10)
DIM textY%(10)
DIM text$(10)
DIM Layer1%
DIM Layer2%
DIM offs1%
DIM offs2%
Vpage1%(0) = 2560 'Width 320*8
Vpage1%(1) = 200 'Height
Vpage2%(0) = 2560 'Width 320*8
Vpage2%(1) = 200 'Height
Layer1% = VARSEG(Vpage1%(0))
Layer2% = VARSEG(Vpage2%(0))
offs1% = VARPTR(Vpage1%(2))
offs2% = VARPTR(Vpage2%(2))
FOR i% = 0 TO 255
cmap%(i%) = 1 + INT(RND * 10)
NEXT i%
FOR i% = 0 TO 255 * 5
div5%(i%) = i% \ 5
NEXT i%
FOR i% = -10 TO 370
ax! = i% * 3.141593 / 180
Lsin(i%) = SIN(ax!)
Lcos(i%) = COS(ax!)
NEXT i%
FOR i% = 0 TO 199
Ly&(i%) = i% * 320&
NEXT i%
RESTORE
FOR i% = 0 TO 10
READ textX(i%)
READ textY(i%)
READ text$(i%)
NEXT i%
CLS
SCREEN 13
Grad 0, 0, 0, 0, 2, 0, 0, 0
Grad 2, 15, 0, 0, 63, 63, 0, 0
Grad 64, 63, 0, 0, 127, 63, 63, 0
Grad 128, 63, 63, 0, 255, 63, 63, 0
Xrad% = 40
Yrad% = 40
Freq% = 6
FoldLeng! = 0
Fdir! = .3
rotdir% = 1
bx% = 91
bxdir% = 1
T# = TIMER
DO
Frames& = Frames& + 1
DEF SEG = Layer1%
Acount% = Acount% + 1
IF Acount% > 360 THEN Acount% = 360
FoldLeng! = FoldLeng! + Fdir!
IF FoldLeng! < -30 THEN
Fdir! = -Fdir!
ELSEIF FoldLeng! > 30 THEN
Fdir! = -Fdir!
END IF
ang% = (ang% + rotdir%)
IF ang% < 0 THEN
rotdir% = -rotdir%
ELSEIF ang% > 360 THEN
rotdir% = -rotdir%
END IF
bx% = bx% + bxdir%
IF bx% < 80 THEN
bxdir% = -bxdir%
ELSEIF bx% > 240 THEN
bxdir% = -bxdir%
END IF
ty% = ABS(SIN(ang% * 3.141593 / 180)) * 50
xx% = bx%
yy% = 125 - ty%
FOR angle% = 0 TO Acount%
A% = ((Freq% * angle%) MOD 360)
B% = (angle% + ang%) MOD 360
X% = (Xrad% + FoldLeng! * Lsin((A%))) * Lsin((B%)) + xx
Y% = (Yrad% + FoldLeng! * Lsin((A%))) * Lcos((B%)) + yy
POKE offs1% + Ly&(Y%) + X%, 255
POKE offs1% + Ly&(Y%) + X% + 1, 127
POKE offs1% + Ly&(Y%) + X% - 1, 127
POKE offs1% + Ly&((Y% - 1)) + X%, 127
POKE offs1% + Ly&((Y% + 1)) + X%, 255
NEXT angle%
T! = (Frames&) * 3.141593 / 180
X% = INT(COS(T! * 8) + SIN(T!) * 140)
Y% = INT(SIN(T! + 2) * SIN(T! * 2) * 90)
xx% = X% + 160
yy% = Y% + 100
IF xx% > 2 AND yy% > 2 AND xx% < 318 AND yy% < 198 THEN
POKE woff1% + Ly&(yy%) + xx%, 255
POKE woff1% + Ly&(yy%) + xx% + 1, 255
POKE woff1% + Ly&(yy%) + xx% - 1, 255
POKE woff1% + Ly&(yy% - 1) + xx%, 255
POKE woff1% + Ly&(yy% + 1) + xx%, 255
POKE woff1% + Ly&(200 - yy% + 1) + (320 - xx%), 255
POKE woff1% + Ly&(200 - yy% - 1) + (320 - xx%), 255
POKE woff1% + Ly&(200 - yy%) + (320 - xx% + 1), 255
POKE woff1% + Ly&(200 - yy%) + (320 - xx% - 1), 255
END IF
T! = TIMER
X% = INT(COS(T! * 8) + SIN(T!) * 140)
Y% = INT(SIN(T! + 2) * SIN(T! * 2) * 90)
xx% = X% + 160
yy% = Y% + 100
IF xx% > 2 AND yy% > 2 AND xx% < 318 AND yy% < 198 THEN
POKE woff1% + Ly&(yy%) + xx%, 255
POKE woff1% + Ly&(yy%) + xx% + 1, 255
POKE woff1% + Ly&(yy%) + xx% - 1, 255
POKE woff1% + Ly&(yy% - 1) + xx%, 255
POKE woff1% + Ly&(yy% + 1) + xx%, 255
POKE woff1% + Ly&(200 - yy% + 1) + (320 - xx%), 255
POKE woff1% + Ly&(200 - yy% - 1) + (320 - xx%), 255
POKE woff1% + Ly&(200 - yy%) + (320 - xx% + 1), 255
POKE woff1% + Ly&(200 - yy%) + (320 - xx% - 1), 255
END IF
IF (Frames& AND 7) = 1 THEN
texX% = textX%(Textidx%)
texY% = textY%(Textidx%)
tex$ = text$(Textidx%)
AF.Print Layer1%, offs1%, texX%, texY, tex$, 245
IF (Frames& AND 15) = 1 THEN
Textidx% = (Textidx% + 1) MOD 11
END IF
END IF
clrmap% = INT(RND * 5)
FOR C& = 321 TO 64000 - 321 STEP 4
DEF SEG = Layer1%
p& = offs1% + C&
clr% = PEEK(p& + 1) + PEEK(p& - 1) + PEEK(p& - 320) + PEEK(p& + 320) + PEEK(p&)
clr% = div5%(clr%)
clrmap% = (clrmap% + 1) AND 255
clr% = clr% - cmap%(clrmap%)
IF clr% < 0 THEN clr% = 0
n1% = clr%
''2
p& = p& + 1
clr% = PEEK(p& + 1) + PEEK(p& - 1) + PEEK(p& - 320) + PEEK(p& + 320) + PEEK(p&)
clr% = div5%(clr%)
clrmap% = (clrmap% + 1) AND 255
clr% = clr% - cmap%(clrmap%)
IF clr% < 0 THEN clr% = 0
n2% = clr%
''3
p& = p& + 1
clr% = PEEK(p& + 1) + PEEK(p& - 1) + PEEK(p& - 320) + PEEK(p& + 320) + PEEK(p&)
clr% = div5%(clr%)
clrmap% = (clrmap% + 1) AND 255
clr% = clr% - cmap%(clrmap%)
IF clr% < 0 THEN clr% = 0
n3% = clr%
''4
p& = p& + 1
clr% = PEEK(p& + 1) + PEEK(p& - 1) + PEEK(p& - 320) + PEEK(p& + 320) + PEEK(p&)
clr% = div5%(clr%)
clrmap% = (clrmap% + 1) AND 255
clr% = clr% - cmap%(clrmap%)
IF clr% < 0 THEN clr% = 0
n4% = clr%
DEF SEG = Layer2%
p2& = offs2% + C& - 320
POKE p2&, n1%
p2& = p2& + 1
POKE p2&, n2%
p2& = p2& + 1
POKE p2&, n3%
p2& = p2& + 1
POKE p2&, n4%
NEXT C&
PUT (0, 0), Vpage2%(0), PSET
FOR i% = 3 TO 32001
Vpage1%(i%) = Vpage2%(i%)
NEXT i%
LOOP UNTIL INKEY$ <> ""
DEF SEG
CLS
SCREEN 0
WIDTH 80
PRINT "FPS:"; Frames& / (TIMER - T#)
PRINT "Fire by Relsoft"
C$ = INPUT$(1)
END
DATA 100,50,"Fire by Relsoft"
DATA 10,40,"From a tutorial by Hugo Elias."
DATA 140,140,"Greetz to..."
DATA 40,170,"God"
DATA 10,160,"Anya Therese"
DATA 10,20,"Rosmelly"
DATA 180,110,"Peter"
DATA 40,60,"Lily"
DATA 160,140,"Marie"
DATA 10,160,"Cristina"
DATA 40,140,"And all the QBasicnews people."
REM $STATIC
SUB AF.Print (Layer%, offs%, Xpos%, Ypos%, text$, col%)
'Prints the standard 8*8 CGA font
'Paramenters:
'Segment=the Layer to print to
'Xpos,Ypos=the coordinates of the text
'Text$=the string to print
'col= is the color to print(gradient)
X% = Xpos%
Y% = Ypos%
Spacing% = 8
FOR i% = 0 TO LEN(text$) - 1
X% = X% + Spacing%
Offset% = 8 * ASC(MID$(text$, i% + 1, 1)) + 14
FOR J% = 0 TO 7
DEF SEG = &HFFA6
Bit% = PEEK(Offset% + J%)
DEF SEG = Layer%
IF Bit% AND 1 THEN POKE offs% + Ly&(Y% + J%) + X%, col% + J%
IF Bit% AND 2 THEN POKE offs% + Ly&(Y% + J%) + (X% - 1), col% + J%
IF Bit% AND 4 THEN POKE offs% + Ly&(Y% + J%) + (X% - 2), col% + J%
IF Bit% AND 8 THEN POKE offs% + Ly&(Y% + J%) + (X% - 3), col% + J%
IF Bit% AND 16 THEN POKE offs% + Ly&(Y% + J%) + (X% - 4), col% + J%
IF Bit% AND 32 THEN POKE offs% + Ly&(Y% + J%) + (X% - 5), col% + J%
IF Bit% AND 64 THEN POKE offs% + Ly&(Y% + J%) + (X% - 6), col% + J%
IF Bit% AND 128 THEN POKE offs% + Ly&(Y% + J%) + (X% - 7), col% + J%
NEXT J%
NEXT i%
END SUB
SUB Grad (col1, r1, g1, b1, col2, r2, g2, b2)
cols = col2 - col1 + 1
rstep! = (r2 - r1) / cols
gstep! = (g2 - g1) / cols
bstep! = (b2 - b1) / cols
r! = r1
g! = g1
B! = b1
FOR col = col1 TO col2
r! = r! + rstep!
g! = g! + gstep!
B! = B! + bstep!
red% = INT(r!)
Green% = INT(g!)
Blue% = INT(B!)
OUT &H3C8, col
OUT &H3C9, red%
OUT &H3C9, Green%
OUT &H3C9, Blue%
NEXT col
END SUB