I have created ivory-like tile on screen. I want to save them. I have become confused by my failed attempts. If anyone would take a look at the following code and suggest a solution, I would be deeply greatful. The last part, Function saving(n), is the notional equivelant of what I need ...
; Making and saving tiles
AppTitle "Making and saving tiles - Escape to Quit"
Global tile
Global tilewidth=60
Global tileheight=120
Graphics tilewidth*11+1, tileheight*5+1, 32, 2
SetBuffer BackBuffer()
tile=CreateImage(59,119,1)
; SetBuffer ImageBuffer(domino,0)
Origin 1,1
For z=0 To 1
SeedRnd 13
; create an ivory look
Color 230,230,210
Rect 0,0,660,600
For i=0 To 400
Color 190+Rnd(0,40), 190+Rnd(0,40), 170+Rnd(0,40)
x=Rnd(-100,760)
xx=x+Rnd(-10, 10)
y=Rnd(-200,600)
yy=y+Rnd(160,600)
Line x,y,xx,yy
Next
Color 0,0,0:Rect -1,-1,661,601,0
Flip
Next
; shading for four directions
For i=0 To 3
Delay 1000
shading(i)
Flip
Next
Delay 1000
shading(0)
cuts()
Flip
Repeat
If KeyDown(1) Then End
Forever
Function shading(n)
; top
If n=0 Then Color 255,255,255
If n=1 Then Color 255,255,255
If n=2 Then Color 190,190,160
If n=3 Then Color 190,190,160
For x=0 To 10
For y=0 To 4
Rect x*tilewidth, y*tileheight, tilewidth-2, 3
Next
Next
; left
If n=0 Then Color 255,255,255
If n=1 Then Color 190,190,160
If n=2 Then Color 190,190,160
If n=3 Then Color 255,255,255
For x=0 To 10
For y=0 To 4
Rect x*tilewidth, y*tileheight, 3, tileheight-2
Next
Next
; bottom
If n=0 Then Color 190,190,160
If n=1 Then Color 190,190,160
If n=2 Then Color 255,255,255
If n=3 Then Color 255,255,255
For x=0 To 10
For y=1 To 5
Rect x*tilewidth, y*tileheight-4, tilewidth-2, 3
Next
Next
; right
If n=0 Then Color 190,190,160
If n=1 Then Color 255,255,255
If n=2 Then Color 255,255,255
If n=3 Then Color 190,190,160
For x=1 To 11
For y=0 To 4
Rect x*tilewidth-4, y*tileheight, 3, tileheight-2
Next
Next
End Function
Function cuts()
; cut it into tiles
Color 0,0,0
For x=0 To 10
For y=0 To 4
Rect x*tilewidth-1, y*tileheight-1, tilewidth+1, tileheight+1,0
Next
Next
End Function
Function saving(n)
i=0
For x=0 To 10
For y=0 To 8 Step 2
ii$=Str(i)
If i<10 ii$="0"+ii$
filename$=Str(n)+ii$+".bmp"
; SaveRectangle(x*tilewidth, y*tilewidth, tilewidth-1, 2*tilewidth-1) as filename$
i=i+1
Next
Next
End Function
|