29-10-2008, 05:53 PM
Are you tired of mapping? Do you want technology to do your work for you? NOW IT'S POSSIBLE!
What you can do with this pro 1337 code!
Go fromthis to this
Or change this into this
Or why not even change this into this
Disclaimer, last ss looks bad because of crappy corner tiles, they should however demonstrate how cool my tut is. Furthermore,
The tut will probably cause a few RTE's, because of x'es/y'es being too small or large, add an If X > 0 where the code crashes = fix.
The code will get frustrated if you place tiles in a u-bent, it wont know which tile will go in the middle. Same if you place one tile, nothing, one tile. If you don't understand this, don't worry, you'll see it for yourself. For the rest.
The code uses the GROUND layer, you just place your main tile, you rightclick your main tile in the MapEditor if you want to AutoTile it, and press whatever caption you gave to CmdAutoTile
The code has NOT been properly tested. IT was made for that new version of MS, but I don't guarantee it'll work. Have fun with it.
Step one,
add
Step two,
Go to the MapEditor, and make a button called CmdAutoTile, and copy PicSelect and rename it to PicAutoTile!
Step three!!
Add this code in FrmMirage :
Step four,
Replace Public Sub MapEditorChooseTile
with this :
What you can do with this pro 1337 code!
Go fromthis to this
Or change this into this
Or why not even change this into this
Disclaimer, last ss looks bad because of crappy corner tiles, they should however demonstrate how cool my tut is. Furthermore,
The tut will probably cause a few RTE's, because of x'es/y'es being too small or large, add an If X > 0 where the code crashes = fix.
The code will get frustrated if you place tiles in a u-bent, it wont know which tile will go in the middle. Same if you place one tile, nothing, one tile. If you don't understand this, don't worry, you'll see it for yourself. For the rest.
The code uses the GROUND layer, you just place your main tile, you rightclick your main tile in the MapEditor if you want to AutoTile it, and press whatever caption you gave to CmdAutoTile
The code has NOT been properly tested. IT was made for that new version of MS, but I don't guarantee it'll work. Have fun with it.
Step one,
add
Code:
Public AutoTileX As Long
Public AutoTileY As Long
Public Counter As Long
Step two,
Go to the MapEditor, and make a button called CmdAutoTile, and copy PicSelect and rename it to PicAutoTile!
Step three!!
Add this code in FrmMirage :
Code:
Private Sub CmdAutotile_Click()
Dim x As Byte, y As Byte
Dim Space As Integer
Dim FilledAlready(0 To MAX_MAPX, 0 To MAX_MAPY) As Boolean
Space = AutoTileY * TILESHEET_WIDTH + AutoTileX
For x = 0 To MAX_MAPX
For y = 0 To MAX_MAPY
If Map.Tile(x, y).Ground = Space Then
If x < MAX_MAPX Then
If Map.Tile(x + 1, y).Ground Space Then
Map.Tile(x + 1, y).Ground = (AutoTileY) * TILESHEET_WIDTH + AutoTileX + 1
If FilledAlready(x + 1, y) = True Then
'Wow, it's a corner!!!
If Map.Tile(x + 1, y + 1).Ground = Space Then
Map.Tile(x + 1, y).Ground = (AutoTileY - 1) * TILESHEET_WIDTH - AutoTileX + 1
ElseIf Map.Tile(x + 1, y - 1).Ground = Space Then
Map.Tile(x + 1, y).Ground = (AutoTileY + 1) * TILESHEET_WIDTH - AutoTileX + 1
End If
Else
FilledAlready(x + 1, y) = True
End If
End If
End If
If x > 0 Then
If Map.Tile(x - 1, y).Ground Space Then
Map.Tile(x - 1, y).Ground = (AutoTileY) * TILESHEET_WIDTH + AutoTileX - 1
If FilledAlready(x - 1, y) = True Then
'Wow, it's a corner!!!
If Map.Tile(x - 1, y - 1).Ground = Space Then
Map.Tile(x - 1, y).Ground = (AutoTileY + 1) * TILESHEET_WIDTH + AutoTileX - 1
ElseIf Map.Tile(x - 1, y + 1).Ground = Space Then
Map.Tile(x - 1, y).Ground = (AutoTileY - 1) * TILESHEET_WIDTH + AutoTileX - 1
End If
Else
FilledAlready(x - 1, y) = True
End If
End If
End If
If y > 0 Then
If Map.Tile(x, y - 1).Ground Space Then
Map.Tile(x, y - 1).Ground = (AutoTileY - 1) * TILESHEET_WIDTH + (AutoTileX)
If FilledAlready(x, y - 1) = True Then
If x > 0 Then
If Map.Tile(x - 1, y - 1).Ground = Space Then
Map.Tile(x, y - 1).Ground = (AutoTileY - 1) * TILESHEET_WIDTH + AutoTileX + 1
ElseIf Map.Tile(x + 1, y + 1).Ground = Space Then
Map.Tile(x, y - 1).Ground = (AutoTileY - 1) * TILESHEET_WIDTH + AutoTileX - 1
End If
End If
Else
FilledAlready(x, y - 1) = True
End If
End If
End If
If y < MAX_MAPY Then
If Map.Tile(x, y + 1).Ground Space Then
Map.Tile(x, y + 1).Ground = (AutoTileY + 1) * TILESHEET_WIDTH + (AutoTileX)
If FilledAlready(x, y + 1) = True Then
If Map.Tile(x - 1, y - 1).Ground = Space Then
Map.Tile(x, y + 1).Ground = (AutoTileY + 1) * TILESHEET_WIDTH + AutoTileX + 1
ElseIf Map.Tile(x + 1, y + 1).Ground = Space Then
Map.Tile(x, y + 1).Ground = (AutoTileY - 1) * TILESHEET_WIDTH + AutoTileX + 1
End If
Else
FilledAlready(x, y + 1) = True
End If
End If
End If
End If
Next y
Next x
End Sub
Step four,
Replace Public Sub MapEditorChooseTile
with this :
Code:
Public Sub MapEditorChooseTile(Button As Integer, Shift As Integer, x As Single, y As Single)
If Button = vbLeftButton Then
EditorTileX = x \ PIC_X
EditorTileY = y \ PIC_Y
frmMirage.shpSelected.Top = EditorTileY * PIC_X
frmMirage.shpSelected.Left = EditorTileX * PIC_Y
Call BltMapEditorTilePreview
Else
If Button = vbRightButton Then
AutoTileX = x \ PIC_X
AutoTileY = y \ PIC_Y
frmMirage.shpSelected.Top = AutoTileX * PIC_X
frmMirage.shpSelected.Left = AutoTileY * PIC_Y
Call BltMapEditorAutoTilePreview
End If
End If
End Sub