Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Never map again! The all-new fully automated mapmaker 2008!
#1
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
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
Reply
#2
Why doesn't anyone reply =(?
Reply
#3
I checked the screenshots and such, but I think adding this to a game is more trouble making than actually mapping it yourself. At least if you use scrolling maps. But I guess it's a very usefull tool if you don't use scrolling maps.

It's a very original tutorial so thats cool ^^
Reply
#4
Sad I did this already on elysium.

Oh well, your code is probably better lol.


Good Job Joost!
Reply
#5
Actually I dimmed one Public Long that isn't even being used, and using another PicBox for the auto-tiling is a waste of space. So gonna re-do that today, cause it's quite ez to re-do this part lal ;p.
Reply
#6
Looks like a great idea!

I'll give it a try later on when you update the tutorial. If it works it should be a great little addition to any game.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)