|
Login
Aktuelle Version
Aktuelle 3d games creator / Darkbasic Professional Version: 7.2vom: 04.02.2009Zum Download bitte hier klicken. Aktuelle News
letztes Update:
05.02.2009
(siehe Neues) Hauptmenü
Suche
Internationale Seiten
DarkBASIC Lounge
Werbung
|
| Autor |
Diskussion |
| Valle |
Veröffentlicht am: 25.07.2010 03:32 |
 Registriert seit:: 13.05.2005 Aus:: Beiträge: 723 |
Valles Wunderkiste edit: Thread umbenannt. Hier kommt jetzt alles von mir rein, was eines neuen Threads nicht würdig ist, ich euch aber trotzdem zeigen will. Es sind kleine Programme, code-only, die visuelle Ideen aus meinem Kopf auf den Bildschirm zu bringen versuchen. Ich liebe Fraktale. Aus dieser Liebe sind schon mehrere Schöpfungen hervorgegangen. Heute diese, viel Vergnügen  .
REM Projekt: Drehfraktal
REM erstellt: 25.07.2010 03:26:13
REM
REM ***** Haupt-Quelldatei *****
#CONSTANT SCREENW 1280
#CONSTANT SCREENH 1024
set display mode SCREENW, SCREENH, 32
sync on : sync rate 0 : sync
hide mouse
set image colorkey 255, 0, 255
cls RGB(32,64,64) : ink 0, 0
dist = (SCREENH/2)^2 : mx = SCREENW/2 : my = SCREENH/2
lock pixels
for x = 0 to SCREENW
for y = 0 to SCREENH
d = (x-mx)^2+(y-my)^2
if d < dist
dot x, y
else
dot x, y, rgb(d*0.0005, d*0.001, d*0.001)
endif
next y
next x
unlock pixels
get image 1, 0, 0, SCREENW, SCREENH, 1
sprite 1, 0, 0, 1 : size sprite 1, SCREENW, SCREENH : set sprite 1, 0, 1
set sprite alpha 1, 100 : hide sprite 1
dT as float
clearTimer as float
startTimer as float
startTimer = -2
oldTime = timer()
do
dT = (timer()-oldTime)*0.001
oldTime = timer()
inc startTimer, dT
if startTimer >= 0
dec angle#, 20*dT
if angle# < -120
angle# = 0
startTimer = -2
endif
endif
inc clearTimer, dT
if clearTimer > 0.008
paste sprite 1, 0, 0
clearTimer = 0
endif
lock pixels
ink 0xff0000, 0
circl(SCREENW/2+2, SCREENH/2, SCREENH/2.1, angle#, 3, 9)
ink 0x00ff00, 0
circl(SCREENW/2, SCREENH/2, SCREENH/2, angle#, 3, 9)
unlock pixels
sync
loop
function circl(x as float, y as float, radius as float, angle as float, innerCircls, passes)
angl as float
innerRadius as float
`--
if passes > 1
angl = angle
innerRadius = radius*1.0/2
for t = 0 to innerCircls-1
inc angl, (360.0/innerCircls)
nx = x+cos(angl)*(radius-innerRadius)
ny = y+sin(angl)*(radius-innerRadius)
circl(nx, ny, innerRadius, angle*2, innerCircls, passes-1)
next t
else
dot x, y
endif
endfunction
kommt noch mehr, wenns wen interessiert, bzw noch jemand hier ist ---------------- Valle aka Knieb
|
|
|
| codecrusher |
Veröffentlicht am: 25.07.2010 19:21 |
DB Freak   Registriert seit:: 10.11.2005 Aus:: DarkSide Beiträge: 366 |
Re: Fraktalexperiment #1 na sehr geile sache... stehe auf sowas... und auf lavalampen^^ kann ma sowas auch machen??? Edit:Lavalampe simulation???? ---------------- kein kommentar ^^
|
|
|
| DarkBasicer |
Veröffentlicht am: 26.07.2010 19:57 |
DB Freak   Registriert seit:: 16.04.2004 Aus:: Dessau-Rosslau - SA Beiträge: 209 |
Re: Fraktalexperiment #1 Also ich für meinen Teil habe gleich Hunger bekommen^^ (natürlich auch noch auf mehr Sachen  ) BTW: Warum gibt es keine Fraktalsuppe zu kaufen (vielleicht scheitert es daran, dass man Nudeln nicht rekursiv schneiden kann!?)  ---------------- --- Projekte --- Spacewars Lab Rush
|
|
|
| Valle |
Veröffentlicht am: 08.08.2010 15:38 |
 Registriert seit:: 13.05.2005 Aus:: Beiträge: 723 |
Mustermuster Hmmm, endlos Muster Man muss Enter drücken, sonst bleibt alles langweilig.
REM Projekt: repeatingPatterns
REM erstellt: 08.08.2010 14:47:38
REM Valle
REM ***** Haupt-Quelldatei *****
REM
#CONSTANT SCREENW 1280
#CONSTANT SCREENH 768
#CONSTANT TILESIZEX 300
#CONSTANT TILESIZEY 300
set display mode SCREENW, SCREENH, 32
sync on : sync rate 0
type tVec
x as float
y as float
endtype
type tBorder
p1 as tVec
p2 as tVec
mp as tVec
omp as tVec
nmp as tVec
b1 as float
ob1 as float
nb1 as float
b1Prog as float
b2 as float
ob2 as float
nb2 as float
b2Prog as float
mpProg as float
endtype
xTiles = SCREENW/TILESIZEX
yTiles = SCREENH/TILESIZEY
scroll as tVec
dim br(1) as tBorder
br(0).p1.x = 0 : br(0).p1.y = 0
br(0).p2.x = TILESIZEX : br(0).p2.y = TILESIZEY
br(1).p1.x = 0 : br(1).p1.y = TILESIZEY
br(1).p2.x = TILESIZEX : br(1).p2.y = 0
oldTime = Timer()
Do
Cls 0x000033
dT# = (Timer()-oldTime)*0.001
oldTime = Timer()
if returnkey()
for t = 0 to 1
if rnd(1)
br(t).nmp.x = TILESIZEX/2 : br(t).nmp.y = TILESIZEY/2
else
br(t).nmp.x = rnd(TILESIZEX) : br(t).nmp.y = rnd(TILESIZEY)
endif
br(t).nb1 = -TILESIZEX/6+rnd(TILESIZEX/3)
if rnd(1)
br(t).nb2 = -br(t).nb1
else
br(t).nb2 = -TILESIZEX/6+rnd(TILESIZEX/3)
endif
br(t).omp.x = br(t).mp.x : br(t).omp.y = br(t).mp.y
br(t).mpProg = 0
br(t).ob1 = br(t).b1 : br(t).b1Prog = 0
br(t).ob2 = br(t).b2 : br(t).b2Prog = 0
next t
endif
for t = 0 to 1
inc br(t).mpProg, dT# : inc br(t).b1Prog, dT# : inc br(t).b2Prog, dT#
if br(t).mpProg > 1 then br(t).mpProg = 1
if br(t).b1Prog > 1 then br(t).b1Prog = 1
if br(t).b2Prog > 1 then br(t).b2Prog = 1
br(t).mp.x = interpolate(br(t).omp.x, br(t).nmp.x, br(t).mpProg, 2)
br(t).mp.y = interpolate(br(t).omp.y, br(t).nmp.y, br(t).mpProg, 2)
br(t).b1 = interpolate(br(t).ob1, br(t).nb1, br(t).b1Prog, 1)
br(t).b2 = interpolate(br(t).ob2, br(t).nb2, br(t).b2Prog, 1)
next t
`Scroll
inc scroll.x, dT#*20 : inc scroll.y, dT#*20
if scroll.x > TILESIZEX then dec scroll.x, TILESIZEX
if scroll.y > TILESIZEY then dec scroll.y, TILESIZEY
for x = 0 to xTiles+1
for y = 0 to yTiles+2
for t = 0 to 1
ink 0xff8800, 0
bentLine(br(t).p1.x+x*TILESIZEX-scroll.x, br(t).p1.y+y*TILESIZEY-scroll.y, br(t).mp.x+x*TILESIZEX-scroll.x, br(t).mp.y+y*TILESIZEY-scroll.y, br(t).b1)
``ink 0x0088ff, 0
bentLine(br(t).mp.x+x*TILESIZEX-scroll.x, br(t).mp.y+y*TILESIZEY-scroll.y, br(t).p2.x+x*TILESIZEX-scroll.x, br(t).p2.y+y*TILESIZEY-scroll.y, br(t).b2)
next t
next y
next x
sync
loop
function bentLine(x1, y1, x2, y2, maxBend)
oldX = x1
oldY = y1
tiles = 20
angle# = atan_full(x2-x1, y2-y1)+90
for t = 1 to tiles
fac# = t*1.0/tiles
x = x1+(x2-x1)*fac# + cos(angle#)*sin(fac#*360)*maxBend
y = y1+(y2-y1)*fac# + sin(angle#)*sin(fac#*360)*maxBend
line oldX, oldY, x, y
oldX = x : oldY = y
next t
endfunction
function atan_full(dist_x as float, dist_y as float)
local angle as float
`--
if dist_y >= 0
if dist_x > 0 then angle = 180.0 + abs(Atan(dist_y/dist_x))
if dist_x < 0 then angle = 360.0 - abs(Atan(dist_y/dist_x))
if dist_x = 0 then angle = 270.0
else
if dist_x > 0 then angle = Atan(dist_y/dist_x) + 180.0
if dist_x < 0 then angle = Atan(dist_y/dist_x)
if dist_x = 0 then angle = 90.0
endif
endfunction angle
function interpolate(num1 as float, num2 as float, progress as float, mode)
local res as float
local true_progress as float
`--
select mode
case 0 : true_progress = progress : endcase :`linear
case 1 : true_progress = sin(-90+progress*90)+1 : endcase :`Anfang langsam
case 2 : true_progress = sin(progress*90) : endcase :`Ende langsam
case 3 : true_progress = sin(-90+progress*180)/2+0.5 : endcase :`Anfang und Ende langsam
endselect
res = num1+(num2-num1)*true_progress
endfunction res
An Lee: Was ist eine auf Spiele spezialisierte Basicsprache ohne vernünftigen Atanfull-Befehl? Das sollte mal ins nächste Update rein. edit: noch ein kleines, ziemlich anstrengendes Schmankerl:
REM Projekt: kreisfraktal zoom
REM erstellt: 24.07.2010 13:19:43
REM Valle
REM ***** Haupt-Quelldatei *****
REM
#CONSTANT SCREENW 1024
#CONSTANT SCREENH 768
set display mode SCREENW, SCREENH, 32
sync on : sync rate 0
oldTime = Timer()
Do
Cls RGB(34, 6, 6)
dT# = (Timer()-oldTime)*0.001
oldTime = Timer()
prog# = prog#+1.5*dT#
realprog# = 1+sin(270+prog#*90)
If prog# > 1.0
prog# = prog#-1.0
bla = 1-bla
EndIf
xOff# = realprog#*SCREENW*0.5
if bla then xOff# = -xOff#
circ(SCREENW*0.5-xOff#, SCREENH*0.5, SCREENW*0.5*(realprog#+1), 9)
Sync
Loop
Function circ(x#, y#, radius#, passes)
circle x#, y#, radius#
If passes > 1
circ(x#-radius#*0.5, y#, radius#*0.5, passes-1)
circ(x#+radius#*0.5, y#, radius#*0.5, passes-1)
EndIf
EndFunction
---------------- Valle aka Knieb
|
|
|
| Valle |
Veröffentlicht am: 08.08.2010 15:59 |
 Registriert seit:: 13.05.2005 Aus:: Beiträge: 723 |
screen wide web Überlagerte Netze.
REM Projekt: netzeffekt
REM erstellt: 24.07.2010 13:38:56
REM Valle
REM ***** Haupt-Quelldatei *****
REM
#CONSTANT SCREENW 1280
#CONSTANT SCREENH 768
set display mode SCREENW, SCREENH, 32
sync on : sync rate 0
hide mouse
oldTime = Timer()
Do
Cls
dT# = (Timer()-oldTime)*0.001
oldTime = Timer()
blx = SCREENW*0.5+cos(a#)*dist#
bly = SCREENH*0.5+sin(a#)*(dist#-20)
dist# = 25+sin(a#*0.2)*20
inc a#, 90*dT#
ink 0x00ff00, 0
Web(blx, bly, 20, 20)
ink 0xff0000, 0
Web(SCREENW-blx, SCREENH-bly, 20, 20)
sync
loop
function web(x, y, dist, bend)
xDots = SCREENW/dist
yDots = SCREENH/dist
rBorder = xDots*dist
dBorder = yDots*dist
for dx = 2 to xDots-1
bentLine(x, y, dx*dist, dist, bend)
bentLine(x, y, dx*dist, dBorder, bend)
next dx
for dy = 1 to yDots
bentLine(x, y, dist, dy*dist, bend)
bentLine(x, y, rBorder, dy*dist, bend)
next dy
endfunction
function bentLine(x1, y1, x2, y2, maxBend)
oldX = x1
oldY = y1
tiles = 14
angle# = atan_full(x2-x1, y2-y1)+90
for t = 1 to tiles
fac# = t*1.0/tiles
x = x1+(x2-x1)*fac# + cos(angle#)*sin(fac#*360)*maxBend
y = y1+(y2-y1)*fac# + sin(angle#)*sin(fac#*360)*maxBend
line oldX, oldY, x, y
oldX = x : oldY = y
next t
endfunction
function atan_full(dist_x as float, dist_y as float)
local angle as float
`--
if dist_y >= 0
if dist_x > 0 then angle = 180.0 + abs(Atan(dist_y/dist_x))
if dist_x < 0 then angle = 360.0 - abs(Atan(dist_y/dist_x))
if dist_x = 0 then angle = 270.0
else
if dist_x > 0 then angle = Atan(dist_y/dist_x) + 180.0
if dist_x < 0 then angle = Atan(dist_y/dist_x)
if dist_x = 0 then angle = 90.0
endif
endfunction angle
vergesst nicht die Konstanten am Anfang eurem Bildschirm anzupassen. Sollte es ruckeln, dann ersetzt die Zeilen 25 bis 27 mit
Web(blx, bly, 40, 20)
ink 0xff0000, 0
Web(SCREENW-blx, SCREENH-bly, 40, 20)
---------------- Valle aka Knieb
|
|
|
| Mc-Over |
Veröffentlicht am: 09.08.2010 16:02 |
 Registriert seit:: 16.09.2005 Aus:: Troisdorf (NRW) Beiträge: 620 |
Re: screen wide web Bei den repeating patterns und dem Netzeffekt hab ich jeweils (auch mit der Änderung) 1-2 FPS. Wenn ich das aber mal ignoriere siehts ganz cool aus.  ---------------- ~~Projekte~~ Modern Lightmapper V.0.4.15
|
|
|
|