Dark Bit Factory &  Gravity

Dark Bit Factory & Gravity

  • July 30, 2010 *
  • Welcome, Guest
Please login or register.

Login with username, password and session length
Advanced search  

Pages: [1]   Go Down

Author Topic: 3D Starfield  (Read 614 times)

0 Members and 1 Guest are viewing this topic.

Hotshot

  • Pentium
  • *****
  • Karma: 42
  • Offline Offline
  • Posts: 1166
    • View Profile
3D Starfield
« on: May 19, 2008 »
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: [Select]
// 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
« Last Edit: May 19, 2008 by Hotshot »
Logged

Shockwave

  • good/evil
  • ADMIN
  • Senior Member
  • ********
  • Karma: 356
  • Offline Offline
  • Posts: 15085
  • evil/good
    • View Profile
    • WWW
Re: 3D Starfield
« Reply #1 on: May 19, 2008 »
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.

Logged
Shockwave ^ Codigos....  Error: Keyboard not attached.... Press F1 to continue.

Hotshot

  • Pentium
  • *****
  • Karma: 42
  • Offline Offline
  • Posts: 1166
    • View Profile
Re: 3D Starfield
« Reply #2 on: May 19, 2008 »
I didnt even do exe files for cobra but I agree that Cobra files size is bloat  :(
I will send exe files another time :)
Logged
Pages: [1]   Go Up
 

 

B l a c k R a i n V.2 by C r i p

Page created in 0.096 seconds with 19 queries.