Hi everybody!
This program shows the creating of a random night skyline. It is to be used in a other program to generate the background of the scene. (has to do with submarine(?!) and ufos )
the scrolling now is just for showing the changings.
Greetings
stef
bugfixed: deleteallimages (was missing)
; PROJECT : scenery-maker
; AUTHOR : stef
; CREATED : 01.11.2005
; EDITED : 09.11.2005
; ---------------------------------------------------------------------
RemStart
Program creates a random scenery/landscape with city and "sinushills"
for using as background
RemEnd
OpenScreen 800,600,32,2
Cls 10
SetFPS 200
Do
skyline_image = GetFreeImage ()
CreateImage skyline_image, 800,400
RenderToImage skyline_image
BoxC 0,380,800,500,1,RGB(10,14,10); small greenish strip
;wx= 1 to number of windows x axis
;wy= 1 to number of windows y axis
;tx= width of tile
;ty= height of tile
;hw= housewidth
;hh= househeight
;hc=housecolour
;p=houseplace
p_city = RndRange (300,1000);place of city
For house_number=1 To 120
p= RndRange (p_city-400,p_city)
wx= RndRange (2,4)
wy=RndRange (2,12)
tx= RndRange (4,5)
ty=RndRange (4,5)
hcr =RndRange (10,50)
;hcg =RndRange (10,20)
;hcb =RndRange (10,20)
ww=1
wh=1
var=RndRange (600,602)
For wx1=1 To wx
For wy1=1 To wy
hw=wx*tx
hh=wy*ty
winc=RndRange (0,1);switch off or on windowlight
BoxC p-hw+(wx1*tx),400-hh+(wy1*ty),p-hw+(wx1*tx)+tx,400-hh+(wy1*ty)+ty,1,RGB(hcr,hcr,hcr)
BoxC p-hw+(wx1*tx)+ww,401-hh+(wy1*ty)+1,p-hw+(wx1*tx)+tx-1,400-hh+(wy1*ty)+ty-1,1,RGB(150*winc+30,150*winc+5,60*winc+5)
Next
Next
Next
BoxC 0,397,800,400,1,RGB(30,30,30)
For x=0 To 800 Step 10;streetlights
CircleC x,392,3,1,RGB(150,150,100)
Next
BlurImage skyline_image, 5
moon_image = GetFreeImage ()
CreateImage moon_image, 100,100
RenderToImage moon_image
CircleC 50,50,25,1,RGB(200,200,100)
CircleC 40,48,25,1,RGB(0,0,0)
land_image = GetFreeImage ()
CreateImage land_image, 800,400
RenderToImage land_image
;stars:
For x= 1 To 300
hcr =RndRange (0,250)
DotC RndRange (0,800),RndRange (0,400),RGB (hcr,hcr,hcr)
Next
;dawn/morninglight:
r=RndRange (0,1)
g=RndRange (0,1)
For x= 0 To 100
BoxC 0,280+2*x,800,282+2*x,1, RGB(x*r,x*g,x+30)
Next
For hills = 0 To 20
EllipseC RndRange (0,800),400, RndRange(80,120),RndRange(30,80),1,RGB(10,15,10)
next
For hills = 1 To 50
hill= RndRange(0,1000)
factor=RndRange (30,100)
For angle= 0 To 180
height= Sin(angle)*factor
hill=hill+1
LineC hill-360,400,hill-360,400-height,RGB(10,15,10)
DotC hill-360,400-height,RGB(15,15,15)
Next
next
BlurImage moon_image,12
DrawImage moon_image,RndRange(100,700),RndRange (100, 180),0
DrawImage skyline_image ,0,0,1
CircleC 90,100,30,1,RGB(0,0,30)
mirror =GetFreeImage()
CopyImage land_image,mirror
MirrorImage mirror,0,1
BlurImage mirror,25
RenderToScreen
x=0
For x=0 To 600
Cls 30
DrawImage land_image,0,x-600,1
DrawImage mirror,0,x-200,0
Sync
Next
Wait 3000
deleteallimages
loop
WaitKey
Another impressive demo , well done!
I love you ideas !