Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Random Tiles
#1
I just added a lil something for placing some random tiles down. You select your 4 tiles you want and it will randomally select one and place it.

Fox wanted it to place our grass tiles.
Reply
#2
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.
Reply
#3
Lea Wrote:zomg double post rawwaaahahawhawhwhawhaahhh

/ban

You've been the weirdest person lately..

Also, nice work Dugor :O

Seems quite useful.
Reply
#4
This is really sweet. Very useful Smile
Reply
#5
Is. The spelling of IndeX an accident?
Reply
#6
No.
Reply
#7
Lea Wrote:zomg double post rawwaaahahawhawhwhawhaahhh

/ban

Stop fucking around, Dave.
Quote:Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)