Mirage Source http://web.miragesource.net/forums/ |
|
Random Tiles http://web.miragesource.net/forums/viewtopic.php?f=208&t=5058 |
Page 1 of 1 |
Author: | Jacob [ Tue Feb 03, 2009 9:33 pm ] | ||
Post subject: | Random Tiles | ||
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.
|
Author: | Jacob [ Wed Feb 04, 2009 4:05 am ] |
Post subject: | Re: Random Tiles |
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. |
Author: | Lea [ Wed Feb 04, 2009 4:32 am ] |
Post subject: | Re: Random Tiles |
zomg double post rawwaaahahawhawhwhawhaahhh /ban |
Author: | Tony [ Wed Feb 04, 2009 5:50 am ] |
Post subject: | Re: Random Tiles |
Lea wrote: zomg double post rawwaaahahawhawhwhawhaahhh /ban You've been the weirdest person lately.. Also, nice work Dugor :O Seems quite useful. |
Author: | Anthony [ Wed Feb 04, 2009 8:00 am ] |
Post subject: | Re: Random Tiles |
This is really sweet. Very useful |
Author: | Doomy [ Wed Feb 04, 2009 8:44 am ] |
Post subject: | Re: Random Tiles |
Is. The spelling of IndeX an accident? |
Author: | Coke [ Wed Feb 04, 2009 9:18 am ] |
Post subject: | Re: Random Tiles |
No. |
Author: | Robin [ Wed Feb 04, 2009 1:07 pm ] |
Post subject: | Re: Random Tiles |
Lea wrote: zomg double post rawwaaahahawhawhwhawhaahhh /ban Stop fucking around, Dave. |
Page 1 of 1 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |