This was made using the demo version of Cobra; download information is available in the useful links section of this board,
My first attempt with the language. It's nothing jaw dropping, but gives an idea of the program structure / syntax.
///////////////////////////////////
// 3D Starfield With Cobra Demo //
// In January '07 //
// By Clyde Based on Shockwave's //
// BB Tutorials //
///////////////////////////////////
program uses pure2d,keyset
Const XRES=640
Const YRES=480
Const XRES2=320
Const YRES2=240
Const MAXSTARS=1000
Var
StarX:Array[MAXSTARS] Of Integer
StarY:Array[MAXSTARS] Of Integer
StarZ:Array[MAXSTARS] Of Real
Procedure SetupStars()
Var a
Begin
For a=0 To MAXSTARS-1
StarX[ a ]=Rand(-30000,30000)
StarY[ a ]=Rand(-30000,30000)
StarZ[ a ]=Rnd(1,30)
Next
End
//
// End Of Procedure SetupStars()
//
Procedure UpdateStars()
Var TX, TY, a
Begin
For a=0 To MAXSTARS-1
If Starz[ a ]>1 Then
TX=( StarX[ a ] / StarZ[ a ])+( XRES2 )
TY=( StarY[ a ] / StarZ[ a ])+( YRES2 )
EndIf
If (TX>0) And (TX<XRES-1) And (TY>0) And (TY<YRES-1) Then
PixelFast( TX, TY, $FFFFFF )
StarZ[ a ] = StarZ[ a ] - 0.25
Else
StarX[ a ]=Rand(-30000,30000)
StarY[ a ]=Rand(-30000,30000)
StarZ[ a ]=30
Endif
Next
End
//
// End Of Procedure UpdateStars()
//
Procedure Main()
Begin
OpenScreen( XRES, YRES, 16, TRUE )
SetupStars()
While Not KeyDown(VK_Escape)
Cls
UpdateStars()
Flip
Wend
CloseScreen()
End
//
// End Of Procedure Main()
//
Begin
Main()
End
There's some pretty funky gfx effects in the examples directory too.