Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Andross from Star Fox
#1
Someone named Joshua Dickerson figured this out back in the 90's and posted it online, I'm guessing the newsgroup comp.lang.basic.misc where I used to hang out. 
He made one of the faces and later on I added some more to the screen. They rotate. I don't know anything about how he made this but it's pretty cool so I thought I would share it. 

Andross is the bad guy from the Super Nintendo game Star Fox. 

Code: (Select All)
'By Joshua Dickerson
'
DECLARE SUB InitProgram ()
DECLARE SUB MainLoop ()
DECLARE SUB Calc3D ()
DECLARE SUB Rotation ()
DECLARE SUB DrawObject ()
'
Dim Shared Lines, World(500, 3)
Dim Shared X, Y, Z, sX, sY, Xa, Ya, Za, sXs, sYs, D
Dim Shared R1, R2, R3, Sr1, Sr2, Sr3, Cr1, Cr2, Cr3, mX, mY, mZ, Eye
'

Read Lines
For I = 1 To Lines
    For J = 1 To 3
        Read World(I, J)
    Next
Next
'
InitProgram
MainLoop
Screen 0
End
'
'CUBE LOOKING THINGY
'
'EMPEROR ANDROSS (STAR FOX)
Data 142
'
'ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄNOSEÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
Data 5,-4,10,-5,-4,10,-5,-4,10,-5,-25,10
Data -5,-25,10,0,-52,0,0,-52,0,5,-25,10
Data 5,-25,10,5,-4,10,5,-25,10,10,-18,2
Data 10,-18,2,10,2,2,10,2,2,5,-4,10
Data 10,2,2,-10,2,2,-10,2,2,-5,-4,10
Data -10,2,2,-10,-18,2,-10,-18,2,-5,-25,10
'
'ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄMOUTHÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
Data -10,2,2,-28,26,0,-10,2,2,0,14,5
Data 0,14,5,10,2,2,28,26,0,10,2,2
Data -28,26,0,0,14,5,0,14,5,28,26,0
Data -28,26,0,0,18,6,0,18,6,28,26,0
Data -28,26,0,0,31,6,0,31,6,28,26,0
Data 0,14,5,0,18,6,-28,26,0,0,36,5
Data 0,36,5,28,26,0,0,31,6,0,36,5
Data -8,47,0,0,36,5,0,36,5,8,47,0
'
'ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄOUTLINE OF FACEÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
Data 0,-52,0,-26,-47,0,-26,-47,0,-37,-32,0
Data -37,-32,0,-37,-6,0,-37,-6,0,-28,26,0
Data -28,26,0,-8,47,0,-8,47,0,8,47,0
Data 8,47,0,28,26,0,28,26,0,37,-6,0
Data 37,-6,0,37,-32,0,37,-32,0,26,-47,0
Data 26,-47,0,0,-52,0
'
'ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄFOREHEADÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
Data 0,-52,0,-23,-33,10,-23,-33,10,-5,-25,10
Data -26,-47,0,-23,-33,10,-37,-32,0,-23,-33,10
Data -37,-18,0,-23,-33,10,-10,-18,2,-23,-33,10
Data 0,-52,0,23,-33,10,23,-33,10,5,-25,10
Data 26,-47,0,23,-33,10,37,-32,0,23,-33,10
Data 37,-18,0,23,-33,10,23,-33,10,10,-18,2
'
'ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄEYES + CHEEKSÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
Data -37,-18,0,-23,-26,12,-23,-26,12,-10,-18,2
Data -37,-18,0,-23,-13,10,-23,-13,10,-10,-18,2
Data -37,-18,0,-23,-17,12,-23,-17,12,-10,-18,2
Data -23,-33,10,-23,-26,12,-23,-17,12,-23,-13,10
Data -10,2,2,-23,-13,10,-23,-13,10,-37,-6,0
Data 37,-18,0,23,-26,12,23,-26,12,10,-18,2
Data 37,-18,0,23,-13,10,23,-13,10,10,-18,2
Data 37,-18,0,23,-17,12,23,-17,12,10,-18,2
Data 23,-33,10,23,-26,12,23,-17,12,23,-13,10
Data 10,2,2,23,-13,10,23,-13,10,37,-6,0

'
Sub Calc3D
    '
    X = -1 * X: Xa = Cr1 * X - Sr1 * Z: Za = Sr1 * X + Cr1 * Z
    X = Cr2 * Xa + Sr2 * Y: Ya = Cr2 * Y - Sr2 * Xa: Z = Cr3 * Za - Sr3 * Ya
    Y = Sr3 * Za + Cr3 * Ya: X = X + mX: Y = Y + mY: Z = Z + mZ: sX = D * X / Z
    sY = D * Y / Z
    '
End Sub

'
Sub DrawObject
    '
    Rotation
    For I = 1 To Lines Step 2
        X = World(I, 1)
        Y = World(I, 2)
        Z = World(I, 3)
        Calc3D
        sXs = sX: sYs = sY
        '
        X = World(I + 1, 1)
        Y = World(I + 1, 2)
        Z = World(I + 1, 3)
        Calc3D
        For ty = 1 To 100 Step 80
            For tt = -100 To 150 Step 60
                Rem LINE (sXs, sYs)-(sX, sY), Eye
                Line (sXs + tt, sYs + ty)-(sX + tt, sY + ty), Eye
            Next tt
        Next ty
    Next
    '
End Sub

'
Sub InitProgram
    '
    Screen 9, 1, 0, 1
    Window (-200, -150)-(200, 150)
    View (8, 9)-(632, 341), 0, 15
    Cls 'PAGE 0
    '
    Screen 9, 1, 1, 0
    Window (-200, -150)-(200, 150)
    View (8, 9)-(632, 341), 0, 15
    Cls 'PAGE 1
    '
    D = 1200 'View point and rotation values
    mZ = -1500
    mX = -5
    R1 = 0
    R2 = 0
    R3 = .3
    '
End Sub

'
Sub MainLoop
    '
    While InKey$ = ""
        _Limit 10
        'R1 = R1 + RND(1) * .05: IF R1 > 6.28 THEN R1 = 0
        'R2 = R2 + RND(1) * .05: IF R2 > 6.28 THEN R2 = 0
        'R3 = R3 + RND(1) * .05: IF R3 > 6.28 THEN R3 = 0
        R1 = R1 + .1: If R1 > 6.28 Then R1 = 0
        '
        Cls: Eye = 7: DrawObject
        Page = Abs(Page = 0) 'Page switching is used to hide the drawing
        Screen 9, 1, 1 - Page, Page 'process so the image looks smooth.
    Wend
    '
End Sub

'
Sub Rotation
    '
    Sr1 = Sin(R1): Sr2 = Sin(R2): Sr3 = Sin(R3)
    Cr1 = Cos(R1): Cr2 = Cos(R2): Cr3 = Cos(R3)
    '
End Sub
Reply
#2
That's pretty cool.
b = b + ...
Reply




Users browsing this thread: 1 Guest(s)