ARCHIVE > Cobra

3D Starfield

(1/1)

Hotshot:


Here the Cobra Version of 3D Starfield.

P.S. I have also Made COPPERFIELD in Cobra too and the files size is 80K but it is not done yet.


--- Code: ---// Small 3D STARFIELD program in COBRAPROGGY :)
PROGRAM 
uses pure2d,keyset

Const MAX_STAR=5000
const STAR_SPEED=1
const WIDTH=640
const HEIGHT=480

var 
   Star_x         : Array[MAX_STAR] of integer   
   Star_y         : Array[MAX_STAR] of integer
   Star_z         : Array[MAX_STAR] of integer         
   s_x,s_y,col,c  : integer
 

Procedure setup_stars()
Begin
      For c=0 To MAX_STAR
          star_x[c]=Rnd(-(WIDTH),(HEIGHT)) 
          star_y[c]=Rnd(-(HEIGHT),(HEIGHT))
          star_z[c]=Rnd(STAR_SPEED,255)
      Next
End

Procedure UpdateStar()
Begin
    For c=0 To MAX_STAR
        star_z[c]=star_z[c]-STAR_SPEED
        If star_z[c]<=STAR_SPEED Then star_z[c]=255
        s_x=(star_x[c]/star_z[c])+(WIDTH/2)
        s_y=(star_y[c]/star_z[c])+(HEIGHT/2)
        col=255-star_z[c]
   
        Pixel(s_x, s_y, ToRGBA(col,col,col))
    Next
End

begin
     OpenScreen(width,height)
     
     setup_stars()
   
     While not keydown(vk_escape)
           CLS
           UpdateStar()
           Flip
     Wend       
End

--- End code ---

Shockwave:
Unfortunately that EXE crashes here Hotshot.
Anyway how come the exe is only 80kb?

Cobra stuff is usually really bloated, and I mean about 1.1mb bloated to even open a screen.

Is this exe assuming I have Cobra installed?
I seem to remember Graham K making Cobra do something like that.

Hotshot:
I didnt even do exe files for cobra but I agree that Cobra files size is bloat  :(
I will send exe files another time :)

Navigation

[0] Message Index

Go to full version