Code: Select all
If InitSprite() = 0 Or InitKeyboard() = 0 Or InitMouse() = 0
MessageRequester("Error", "Can't open DirectX 7 Or later", 0)
End
EndIf
numar=200
Structure part
x.f
y.f
sopas.b
EndStructure
Dim sand.part(numar)
For n=0 To numar
sand(n)\x=5+Random(789)
sand(n)\y=Random(200)
Next
If OpenScreen(800,600,32,"Dabidu")
Else
MessageRequester("Error", "Can't open a 800*600 - 32 bit screen !", 0)
EndIf
fondo=CreateSprite(#PB_Any,800,100,0)
StartDrawing(SpriteOutput(fondo))
folor=RGB(0,155,20)
LineXY(0,95,200,90,folor)
LineXY(200,90,398,50,folor)
LineXY(398,50,398,20,folor)
LineXY(398,20,799,0,folor)
FillArea(790,80,folor,folor)
Box(0,0,10,100)
StopDrawing()
subfond=CreateSprite(#PB_Any,800,600,0)
StartDrawing(SpriteOutput(subfond))
folor=RGB(0,155,20)
Box(0,0,5,600,folor)
Box(795,0,5,600,folor)
Box(65,400,150,5,folor)
Box(80,479,5,120,folor)
LineXY(200,479,300,400)
LineXY(200,479,200,485)
LineXY(200,485,300,406)
LineXY(300,400,300,406)
FillArea(202,482,folor,folor)
LineXY(430,200,700,400)
LineXY(430,206,700,406)
LineXY(430,200,430,206)
LineXY(700,400,700,406)
FillArea(432,203,folor,folor)
StopDrawing()
Repeat
;=========================================================================================
DisplaySprite(subfond,0,0)
DisplayTransparentSprite(fondo,0,499)
;=========================================================================================
StartDrawing(ScreenOutput())
FrontColor(255,255,0)
For n=0 To numar
Plot(sand(n)\x,sand(n)\y)
If Point(sand(n)\x,sand(n)\y+1)=0
sand(n)\y=sand(n)\y+1
Else
samba=0
If Point(sand(n)\x-1,sand(n)\y+1)<>0
samba=samba+2
EndIf
If Point(sand(n)\x+1,sand(n)\y+1)<>0
samba=samba+4
EndIf
If Point(sand(n)\x-2,sand(n)\y+1)<>0
samba=samba+8
EndIf
If Point(sand(n)\x+2,sand(n)\y+1)<>0
samba=samba+16
EndIf
Select samba
Case 0
If Random(1)
sand(n)\x=sand(n)\x+1
Else
sand(n)\x=sand(n)\x-1
EndIf
Case 2
sand(n)\x=sand(n)\x+1
Case 4
sand(n)\x=sand(n)\x-1
Case 6
If Random(1)
sand(n)\x=sand(n)\x+1
Else
sand(n)\x=sand(n)\x-1
EndIf
Case 8
sand(n)\x=sand(n)\x+1
Case 10
sand(n)\x=sand(n)\x+1
Case 14
sand(n)\x=sand(n)\x+1
Case 16
sand(n)\x=sand(n)\x-1
Case 20
sand(n)\x=sand(n)\x-1
Case 22
sand(n)\x=sand(n)\x-1
Case 26
sand(n)\x=sand(n)\x+1
Case 28
sand(n)\x=sand(n)\x-1
Case 30
sand(n)\sopas=1
EndSelect
EndIf
Next
StopDrawing()
;====================================
;====================================
StartDrawing(SpriteOutput(subfond))
For n=0 To numar
If sand(n)\sopas
pichi=Random(55)+200
FrontColor(pichi,pichi,0)
Plot(sand(n)\x,sand(n)\y)
sand(n)\x=5+Random(789)
sand(n)\y=0
sand(n)\sopas=0
EndIf
Next
StopDrawing()
;====================================
;====================================
FlipBuffers(0)
ExamineKeyboard()
Until KeyboardPushed(#PB_Key_Escape)
End