|
-
Oct 8th, 2002, 11:34 AM
#1
Thread Starter
Fanatic Member
Putting different levels of fog around the place..
well, my code is shonky, so your job is to find out how to fix it...
I am tryingto make it so that a certain tile's property will be 'viewed = true', so that all the tiles around it will have different levels of fog....
so lets say tile(3, 4) has viewed = true, all the tiles around it:
tile(2, 4)
tile(4, 4)
tile(3, 3)
tile(3, 2)
(if we get that working we'll do the corner tiles as well, i.e.
tile(2, 3)
tile(4, 5)
tile(4, 3)
tile(2, 5)
)
would be reasonably easy to see, and so on...
Code:
Public Sub DrawFog()
On Error Resume Next
For X = 0 To 7
For Y = 0 To 7
If Grid(X, Y).Viewed = False Then
If X < 7 Then
If Grid(X + 1, Y).FogAmount >= 0 Then
Grid(X, Y).FogAmount = Grid(X + 1, Y).FogAmount + 1
End If
End If
If X > 0 Then
If Grid(X - 1, Y).FogAmount >= 0 Then
Grid(X, Y).FogAmount = Grid(X - 1, Y).FogAmount + 1
End If
End If
If Y < 7 Then
If Grid(X, Y + 1).FogAmount >= 0 Then
Grid(X, Y).FogAmount = Grid(X, Y + 1).FogAmount + 1
End If
End If
If Y > 0 Then
If Grid(X, Y - 1).FogAmount >= 0 Then
Grid(X, Y).FogAmount = Grid(X, Y - 1).FogAmount + 1
End If
End If
If Grid(X, Y).FogAmount >= 0 Then
BlitFog X, Y, Grid(X, Y).FogAmount
End If
Else
Grid(X, Y).FogAmount = -1
End If
Next Y
Next X
End Sub
Public Sub BlitFog(ByVal X As Long, ByVal Y As Long, ByVal FogAmount As Long)
Select Case FogAmount
Case 0 'Darkest Fog
BitBlt picMain.hdc, (X * 32), (Y * 32), 32, 32, DCList.FogMask1_DC, 0, 0, vbSrcPaint
picMain.Refresh
BitBlt picMain.hdc, (X * 32), (Y * 32), 32, 32, DCList.Fog1_DC, 0, 0, vbSrcAnd
picMain.Refresh
Case 1
BitBlt picMain.hdc, (X * 32), (Y * 32), 32, 32, DCList.FogMask2_DC, 0, 0, vbSrcPaint
picMain.Refresh
BitBlt picMain.hdc, (X * 32), (Y * 32), 32, 32, DCList.Fog2_DC, 0, 0, vbSrcAnd
picMain.Refresh
End Select
End Sub
/: Tim :\____________________
\: VB, HTML, ASP, VBScript, QBASIC, JavaScript :/
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|