Grid in Map

Welcome to today’s tutorial will show you how to make a grid on the map

First go to client > frmEditor_Map and Create Checkbox (chkGrid) double-click and type```

ShowGrid = chkGrid.Value


Next

Go to the ModGlobals and we add

Public ShowGrid As Byte


Next

Search```

Public Sub BltDirection(ByVal X As Long, ByVal Y As Long)

We add the


If Options.Debug = 1 Then On Error GoTo errorhandler

this


' render grid

rec.top = 24

rec.Left = 0

rec.Right = rec.Left + 32

rec.Bottom = rec.top + 32

Call Engine_BltFast(ConvertMapX(X * PIC_X), ConvertMapY(Y * PIC_Y), DDS_Direction, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)

Next go to modDirectDraw7

add this


Public Sub BltGrid(ByVal X As Long, ByVal Y As Long)

Dim rec As DxVBLib.RECT

' render grid

rec.top = 24

rec.Left = 0

rec.Right = rec.Left + 32

rec.Bottom = rec.top + 32

Call Engine_BltFast(ConvertMapX(X * PIC_X), ConvertMapY(Y * PIC_Y), DDS_Direction, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)

End Sub

In modDirectDraw7 search


' blit out a square at mouse cursor

If InMapEditor Then

	 If frmEditor_Map.optBlock.Value = True Then

		 For X = TileView.Left To TileView.Right

			 For Y = TileView.top To TileView.Bottom

				 If IsValidMapPoint(X, Y) Then

					 Call BltDirection(X, Y)

				 End If

			 Next

		 Next

	 End If

	 Call BltTileOutline

End If

add the


	 If ShowGrid Then

	 For X = TileView.Left To TileView.Right

		 For Y = TileView.top To TileView.Bottom

			 If IsValidMapPoint(X, Y) Then

				 Call BltGrid(X, Y)

			 End If

		 Next

	 Next

End If

Srry for my bad English

You probably should point out that it’s for EO 2 and other DX7 engines, but nice tutorial, simple and to the point.

Thanx ;]

Nice. It would be good if you get someone to fix your english. And also why use a byte? Use a boolean.

Log in to reply