Author Topic: Dot Tunnel[BB2D]  (Read 918 times)

0 Members and 1 Guest are viewing this topic.

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 16784
  • Karma: 439
  • evil/good
    • View Profile
    • My Homepage
Dot Tunnel[BB2D]
« on: May 02, 2006 »


Just a dot tunnel in Blitz 2D to get things started off in this forum..
I didn't like seeing it without any posts!

Code: [Select]
;
; Dot Tunnel
; (C) Shockwave 2006.
;
;================================================================================

        Const        xres        =        800
        Const        yres        =        600
       
        Const        halfx=xres/2
        Const        halfy=yres/2

        Graphics xres,yres,0,1
        SetBuffer BackBuffer()

;--------------------------------------------------------------------------------

                Const        ringnum        =        70
       
                Dim        rlx(ringnum);        X location of rings
                Dim rly(ringnum);        Y location of rings
                Dim rlz#(ringnum);        Z location of rings
                Dim ringstart(ringnum)
               
                Dim        crx#(7200)
                Dim cry#(7200)

                Global        wavepointer=0
                Global        floop#=1
                Global        fuck=0
                Global bn=ringnum
;--------------------------------------------------------------------------------
; We need to generate ring positions for all rings at first.
;--------------------------------------------------------------------------------

For a=1 To ringnum
                        ringstart(a)=fuck
                        fuck=fuck+7
                        If fuck>80 fuck=fuck-80
                        rlx(a)=  800*Sin(wavepointer/2)
                        rly(a)=  800*Cos(wavepointer)
                                               
                        rlz#(a)= floop#
                        floop#=  floop#+.5
                        wavepointer=wavepointer+5
Next               
               

For aa=1 To 7200
        crx#(aa)=2000*Sin(Float(aa)/20)
        cry#(aa)=2000*Cos(Float(aa)/20)
Next
       
;--------------------------------------------------------------------------------
; Main loop;
;--------------------------------------------------------------------------------


While Not KeyDown(1)
        rings()
        Flip
        Cls
Wend


Function rings()
LockBuffer BackBuffer()
For a=1 To ringnum

                tx=(rlx(bn)/rlz(bn))+halfx
                ty=(rly(bn)/rlz(bn))+halfy       
fl=0
If bn Mod 4 = 0 Then
                clr1=$040404*a
                clr2=$010301*a
                clr3=$000100*a

                fl=1
Else
                clr1=$010201*a
EndIf
If tx>0 And tx<xres And ty>0 And ty<yres Then
                WritePixelFast tx,ty,clr1
End If
                For b=ringstart(bn) To 7200 Step 80
                        xpl=(crx(b)/rlz(bn))+tx
                        ypl=(cry(b)/rlz(bn))+ty
                        If xpl>1 And xpl<xres-1 And ypl>1 And ypl<yres-1 Then
                                WritePixelFast xpl,ypl,clr1
                                If fl=1 Then
                                WritePixelFast xpl+1,ypl,clr2
                                WritePixelFast xpl-1,ypl,clr2
                                WritePixelFast xpl,ypl-1,clr2
                                WritePixelFast xpl,ypl+1,clr2

                                WritePixelFast xpl+2,ypl,clr3
                                WritePixelFast xpl-2,ypl,clr3
                                WritePixelFast xpl,ypl-2,clr3
                                WritePixelFast xpl,ypl+2,clr3


                                End If

                        End If
                Next
                ringstart(bn)=ringstart(bn)+14
               
                If ringstart(bn)>80 ringstart(bn)=ringstart(bn)-80

                rlz#(bn)=rlz#(bn)-.1
               
                If rlz#(bn)<=0 Then
                        rlz#(bn)=rlz#(bn)+35
                        rlx(bn)=  800*Sin(wavepointer/2)
                        rly(bn)=  800*Cos(wavepointer)
                        wavepointer=wavepointer+5
                        bn=bn+1
                End If
                bn=bn-1
                If bn<=0 bn=ringnum
Next
UnlockBuffer BackBuffer()
End Function
« Last Edit: July 21, 2007 by Shockwave »
Shockwave ^ Codigos
Challenge Trophies Won:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7145
  • Karma: 69
    • View Profile
Re: Dot Tunnel
« Reply #1 on: May 02, 2006 »
I had to change the boundary checkline as I got a MAV on colour3s wpf, to this for it to work too btw dude:

Code: [Select]
If xpl>2 And xpl<xres-2 And ypl>2 And ypl<yres-2 Then

Nifty dot tunnel Shockie, and neat on showing the central pivots of the rings.
Wonder what that'll turn out like in FB mate! :)

Cheers and all the best,
Clyde.
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 16784
  • Karma: 439
  • evil/good
    • View Profile
    • My Homepage
Re: Dot Tunnel
« Reply #2 on: May 03, 2006 »
Funny you should say that.. .  .
I feel a code challenge coming on soon.
Shockwave ^ Codigos
Challenge Trophies Won: