Board Logo
« Star Ship Graphics »

Welcome Guest. Please Login or Register.
Jan 16th, 2018, 3:42pm


Conforums Terms of Service | Membership Rules | Home | Search | Recent Posts | Notification | Format Your Message | Installation FAQ

Please use the forums Search feature before asking.
Please post code using the code box described in Format Your Messages.
This will keep indentation, separate it better form the message and prevent gibberish.
If the code is too long for one post or additional files are needed, upload a ZIP archive to the Just BASIC Files Archive Site.

« Previous Topic | Next Topic »
Pages: 1 2  Notify Send Topic Print
 hotthread  Author  Topic: Star Ship Graphics  (Read 5354 times)
specsdude
Guest
xx Re: Star Ship Graphics
« Reply #15 on: Dec 18th, 2010, 10:29am »

Yes I know but since this kind of program has probably been made before perhaps someone has already found a good site- was just checking...

Im kinda busy sorting out other stuff and it would have been nice not to spend half an hour finding the right site, plus downloading to see what music is like.
User IP Logged

specsdude
Guest
xx Re: Star Ship Graphics
« Reply #16 on: Jan 4th, 2011, 4:16pm »

I have posted a new release of Explore Mode- see the Announcements board.

specsdude
User IP Logged

Kaplooey
New Member
Image


member is offline

Avatar




PM

Gender: Male
Posts: 6
xx Re: Star Ship Graphics
« Reply #17 on: Feb 28th, 2011, 2:39pm »

on Dec 9th, 2010, 11:34am, cundo wrote:
I have uploaded a demo. Same thread Star Ship Adventure (unfinished)


Simulates a 3d perspective, I'm not a math expert so I know this code could be improved a lot.

There are some new BMPs, which are resizing versions of the rock. I'm doing it this way instead of using the spriteScale command, because that command doesn't free the memory and creates a new image with each scale process (little bug). Also I can add some effects this way, ie: far away objects are darker.


Note: There is no adventure yet. undecided




WOW, that's amazing!. Nice job... I didn't really want to enter I just wanted to see the entries but that is great cheesy
User IP Logged

bluatigro
Full Member
ImageImageImageImage


member is offline

Avatar

cxio difersas el tio respondas cxio samvaloras [ thats esperanto for : everybody is different therefore everybody is equal ]


PM

Gender: Male
Posts: 229
xx Re: Star Ship Graphics
« Reply #18 on: May 1st, 2013, 09:23am »

explosions !!

needs some tinkering

Code:
global low , NumberOfOctaves
WindowWidth = DisplayWidth
WindowHeight = DisplayHeight
global height , pi , winx , winy , sprx , spry
global black , red , green , yellow
global blue , magenta , cyan , white
global pink , purple , gray , orange
global block , dot , dot6 , chaos , marble
winy = WindowHeight
winx = WindowWidth
pi = atn( 1 ) * 4
black = rgb( 0 , 0 , 0 )
red = rgb( 255 , 0 , 0 )
green = rgb( 0 , 255 , 0 )
yellow = rgb( 255 , 255 , 0 )
blue = rgb( 0 , 0 , 255 )
magenta = rgb( 255 , 0 , 255 )
cyan = rgb( 0 , 255 , 255 )
white = rgb( 255 , 255 , 255 )
pink = rgb( 255 , 127 , 127 )
orange = rgb( 255 , 127 , 0 )
gray = rgb( 127 , 127 , 127 )
purple = rgb( 127 , 0 , 127 )

''explosion : low = 0
''island : low = 2
low = 2
''until now i did not change this
NumberOfOctaves = 8


nomainwin
graphicbox #m.g , 0 , 0 , winx , winy
open "perlin noise" for graphics as #m
  #m "trapclose [quit]"
  #m.g "when characterInput [quit]"

  ''these are the spritesize
  ''200 x 200 = +-5 minutes
  ''whit a cone plane : sprx = spry !!!
  sprx = 100
  spry = 100

  for y = 0 to spry
    for x = 0 to sprx
      q = ( perlin( x , y ) - 24.9 ) * 2400

''plane = cone x , y
''explosion , island
af = 1 - sqr( ( x - sprx / 2 ) ^ 2 _
            + ( y - spry / 2 ) ^ 2 ) _
            / ( sprx * .5 )

''plane = slope y
''vlames
''af = y / spry


      if af < 0 then af = 0
      if af > 1 then af = 1
      ''for island
      ''clr = fire( 1 - af * q / 255  _
      '', yellow , green , gray , white )
      ''f = ( last - q ) * af / 32 + 0.5
      ''clr = mix( clr , f , black )

      ''for explosion :
      clr=fire(1-af*q/255 _
      ,black,red,yellow,white)
      z = ( q * af - 16 ) / 3
      if af * q < 5 then
        call pixel x , y , black , white
      else
        ''for explotion :
        call pixel x , y , clr , black
        ''for island :
        ''  call drawline x , y , x , y - z , clr
      end if
      last = q
    next x
  next y
  #m.g "getbmp bmp 0 0 ";sprx;" ";spry*2
''  bmpsave "bmp" , DefaultDir$ _
''    + "\BMP\explosoin.bmp"
  notice "READY"
wait

END
''sprite graphics
sub pixel x , y , clr , back
  call setcolor clr
  #m.g "goto " ; x ; " " ; y + spry
  #m.g "down"
  #m.g "set " ; x ; " " ; y + spry
  #m.g "up"
  call setcolor back
  #m.g "goto " ; x ; " " ; y
  #m.g "down"
  #m.g "set " ; x ; " " ; y
  #m.g "up"
end sub
sub drawline x1 , y1 , x2 , y2 , clr
  call setcolor black
  #m.g "down"
  #m.g "line " ; x1 ; " " ; y1 _
       ; " " ; x2 ; " " ; y2
  #m.g "up"
  call setcolor clr
  #m.g "down"
  #m.g "line " ; x1 ; " " ; y1 + spry _
       ; " " ; x2 ; " " ; y2 + spry
  #m.g "up"
end sub
''perlin noise functions
function Noise( x , y )
  x = x + winx * 50
  y = y + winy * 5
  n = x + y * winx
  n = ( n * 2 ^ 13 ) xor n
  Noise = ( 1.0 - ( (n * (n * n * 15731 + 789221 ) _
  + 1376312589 ) and ( 2 ^ 24 - 1) ) / 1073741824.0 )
end function
function SmoothNoise( x , y )
  corners = ( Noise(x-1, y-1)+Noise(x+1, y-1)+Noise(x-1, y+1)+Noise(x+1, y+1) ) / 16
  sides   = ( Noise(x-1, y)  +Noise(x+1, y)  +Noise(x, y-1)  +Noise(x, y+1) ) /  8
  center  =  Noise(x, y) / 4
  SmoothNoise = corners + sides + center
end function
function InterpolateNoise( x , y )
  integerX = int( x )
  fractionalX = x - integerX
  integerY = int( y )
  fractionalY = y - integerY
  v1 = SmoothNoise( integerX    , integerY )
  v2 = SmoothNoise( integerX + 1, integerY )
  v3 = SmoothNoise( integerX    , integerY + 1 )
  v4 = SmoothNoise( integerX + 1, integerY + 1 )
  i1 = Interpolate( v1 , v2 , fractionalX )
  i2 = Interpolate( v3 , v4 , fractionalX )
  InterpolateNoise = Interpolate( i1 , i2 , fractionalY )
end function
function Interpolate( a , b , x )
  ft = x * 3.1415927
  f = ( 1 - cos( ft ) ) * .5
  Interpolate =  a * ( 1 - f ) + b * f
end function
function perlin( x , y )
  total = 0
  n = NumberOfOctaves - 1
  for i = low to low + n
    frequency = 2 ^ i
    amplitude = pi
    total = total _
    + InterpolateNoise( x / frequency , y / frequency ) * amplitude
  next i
  perlin = total
end function
[quit]
  close #m
end
''color functions
function fire( x ,a,b,c,d)
  x = 1 - x ^ 2
  if x < 2/3 then
    if x < 1/3  then
      fire = mix( a , x * 3 , b )
    else
      fire = mix( b , (x-1/3)*3 , c )
    end if
  else
    fire = mix( c , (x-2/3)*3 , d )
  end if
end function
sub setcolor kl
  r = int( kl and 255 )
  g = int( kl / 256 ) and 255
  b = int( kl / 256 / 256 ) and 255
  #m.g "backcolor " ; r ;" "; g ;" "; b
  #m.g "color " ; r ; " " ; g ; " " ; b
end sub
function rad( deg )
  rad = deg * pi / 180
end function
function rainbow( deg )
  rainbow = rgb( sin( rad( deg ) ) * 127 + 128 _
  , sin( rad( deg - 120 ) ) * 127 + 128 _
  , sin( rad( deg + 120 ) ) * 127 + 128 )
end function
function rgb( r , g , b )
  rgb = ( r and 255 ) _
  + ( g and 255 ) * 256 _
  + ( b and 255 ) * 256 * 256
end function
function mix( kl1 , f , kl2 )
  if f < 0 then f = 0
  if f > 1 then f = 1
  r1 = int( kl1 and 255 )
  g1 = int( kl1 / 256 ) and 255
  b1 = int( kl1 / 256 / 256 ) and 255
  r2 = int( kl2 and 255 )
  g2 = int( kl2 / 256 ) and 255
  b2 = int( kl2 / 256 / 256 ) and 255
  dr = r2 - r1
  dg = g2 - g1
  db = b2 - b1
  dr = dr * f
  dg = dg * f
  db = db * f
  r = r1 + dr
  g = g1 + dg
  b = b1 + db
  mix = rgb( r and 255 , g and 255 , b and 255 )
end function
 
User IP Logged

Pages: 1 2  Notify Send Topic Print
« Previous Topic | Next Topic »

Conforums Terms of Service | Membership Rules | Home | Search | Recent Posts | Notification | Format Your Message | Installation FAQ

Donate $6.99 for 50,000 Ad-Free Pageviews!

| |

This forum powered for FREE by Conforums ©
Sign up for your own Free Message Board today!
Terms of Service | Privacy Policy | Conforums Support | Parental Controls