I'm double posting because I can.
Here's a quick tut on how to do it:
Code:
Public RandomTile(0 To 3) As Integer
Public RandomTileSelected As Byte
On the mapeditor form, add an array of picture boxes. Make sure the picturebox 'AutoRedraw' is set to True. I did 4, you can do as many as you want. Now add a checkbox and name it ChkRandomTile.
Code:
Private Sub picRandomTile_Click(IndeX As Integer)
RandomTileSelected = IndeX
End Sub
This will be used for setting the selected random tile with an actual tile.
Code:
Public Sub MapEditorMouseDown(Button As Integer)
Dim Tile As Integer
If Not isInBounds Then Exit Sub
If Button = vbLeftButton Then
If frmMirage.optLayers.Value Then
Tile = EditorTileY * TILESHEET_WIDTH + EditorTileX
If frmMirage.chkRandomTile Then Tile = RandomTile(Int(Rnd * 4))
With Map.Tile(CurX, CurY)
If frmMirage.optGround.Value Then .Ground = Tile
If frmMirage.optMask.Value Then .Mask = Tile
If frmMirage.optAnim.Value Then .Anim = Tile
If frmMirage.optFringe.Value Then .Fringe = Tile
End With
Else
This picks a random tile from your array.
Code:
Public Sub MapEditorChooseTile(Button As Integer, X As Single, Y As Single)
If Button = vbLeftButton Then
EditorTileX = X \ PIC_X
EditorTileY = Y \ PIC_Y
If frmMirage.chkRandomTile Then RandomTile(RandomTileSelected) = EditorTileY * TILESHEET_WIDTH + EditorTileX
frmMirage.shpSelected.Top = EditorTileY * PIC_Y
frmMirage.shpSelected.Left = EditorTileX * PIC_Y
Call BltMapEditorTilePreview
End If
End Sub
Sets the selected random tile with your tile.
I'm leaving the drawing up to you guys.
To set a random tile you first click it's picture box then select your tile. When you have the chkRandomTile selected it will randomally place one of your random tiles down instead of the regular tile selection.