Author Topic: Short Intro Challenge - Parallax Starfield  (Read 3989 times)

0 Members and 1 Guest are viewing this topic.

Offline TinDragon

  • Pentium
  • *****
  • Posts: 644
  • Karma: 24
    • View Profile
    • J2K's blog
Here's another one, a real basic starfield as I couldn't think of anything else :)
Code: [Select]
Graphics 640,480,0,2
SetBuffer BackBuffer()
Dim starx(600)
Dim stary(600)
For lop=0 To 600
starx(lop)=Rnd(640)
stary(lop)=Rnd(480)
Next
Repeat
Cls
For lop=0 To 600
speed=1+(lop Mod 3)
starx(lop)=starx(lop)+speed
If starx(lop)>640 Then starx(lop)=0
Color 85*speed,85*speed,85*speed
Plot starx(lop),stary(lop)
Next
Flip
Until KeyDown(1) Or MouseDown(1)

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17407
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: Short Intro Challenge - Parallax Starfield
« Reply #1 on: June 11, 2006 »
A little unimaginative but Ok.
Btw, you've wasted several lines, I shrunk it for you;
Code: [Select]
Graphics 640,480,0,2
SetBuffer BackBuffer()
Dim starx(600),stary(600)
For lop=0 To 600
starx(lop)=Rnd(640)
stary(lop)=Rnd(480)
Next
Repeat
Cls
For lop=0 To 600
starx(lop)=starx(lop)+(1+(lop Mod 3))
If starx(lop)>640 Then starx(lop)=0
Color 85*(1+(lop Mod 3)),85*(1+(lop Mod 3)),85*(1+(lop Mod 3))
Plot starx(lop),stary(lop)
Next
Flip
Until KeyDown(1) Or MouseDown(1)
Shockwave ^ Codigos
Challenge Trophies Won:

Offline Hotshot

  • DBF Aficionado
  • ******
  • Posts: 2114
  • Karma: 91
    • View Profile
Re: Short Intro Challenge - Parallax Starfield
« Reply #2 on: May 23, 2011 »
Here the BlitzMax Version :)

Code: [Select]
Graphics 640,480,0

Local starx[601]
Local stary[601]

For lop=0 To 600
    starx[lop]=Rnd(640)
    stary[lop]=Rnd(480)
Next

Repeat
      Cls
      For lop=0 To 600
          starx[lop]=starx[lop]+(1+(lop Mod 3))
          If starx[lop]>640 Then starx[lop]=0
          SetColor 85*(1+(lop Mod 3)),85*(1+(lop Mod 3)),85*(1+(lop Mod 3))
          Plot starx[lop],stary[lop]
      Next
      Flip
Until KeyDown(KEY_ESCAPE) Or MouseDown(1)
« Last Edit: May 23, 2011 by Hotshot »