Dark Bit Factory & Gravity
PROGRAMMING => General coding questions => Topic started by: DeXtr0 on September 11, 2007
-
Hey guys,
I was watching some intro's the last couple of days and I noticed the remakes of those neat Vision Factory intro's.
A couple of there intro's have those nice twisting/curling (or how to call it) sinusscrollers effect.
What I mean are those sinusscrollers which look like a "tube" so you see the backside of the characters aswell...
Does anybody know the technique behind it ?
All help is welcome since I got no clue ???
Thanks a lot,
DeXtr0
-
Heres some Freebasic code to do what I think you are after.
For each x position
Calculate y1 and y2 positions (roughly 90 degress apart (see +1.3 below))
Do some lighting
Draw lines (here you would texture something interesting instead of just drawing a plain line)
Screen 19,32
Dim As Integer x,y1,y2,c
For x=0 To 799
y1=200+Sin(x/30.0)*20
y2=200+Sin(x/30.0+1.3)*20
If y1>y2 Then
c=RGB(30,30,30)
Else
c=RGB((y2-y1)*7+50,10,50)
End if
Line (x,y1)-(x,y2),c
Next
SLEEP
-
If you are using some 3D api (OGL or DX9), you can scroll an texture (with alpha blend) on a simple cylinder :) , something like this one (http://dbfinteractive.com/index.php?topic=1323.0) ;)
-
Wow guys you are grreat !
Never thought the answer was getting here that fast...
I'm coding in PureBasic so I'll have to check how I have to do it there but i'm definately going to try both ways. (after my holiday, I leave in 2 days) :D
1000x Thanks guys,
DeXtr0
P.S. Scrolling a texture, never thought of that .... for doing a scroller. I'll try very very soon...
-
Also check Atari-Forum: Trying to find the algorithm of cuddly demos "DNA DEMO&..." (http://www.atari-forum.com/viewtopic.php?t=7438&highlight=dna+scroller).
-
Wow p01, cool tip !
Thanks a lot,
DeXtr0
-
Here is a PB version of the source:
InitSprite()
OpenScreen(800,600,32,"Test")
Repeat
For x=0 To 799
y1 = 200+Sin(x/30.0)*20
y2 = 200+Sin(x/30.0+1.3)*20
If y1>y2
c = RGB(30,30,30)
Else
c = RGB((y2-y1)*7+50,10,50)
EndIf
StartDrawing(ScreenOutput())
LineXY (x,y1,x,y2,c)
StopDrawing()
Next
FlipBuffers()
Until GetAsyncKeyState_(#VK_ESCAPE)
-
Whohoo sweet VA!N :)
Thanks a lot ,really appreciate that..
.DeXtr0