Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Clear all Layers
#1
GSD tutorial for extra layers is needed, or you'll have to figure out which once you dont need. This code uses more layers than a unedited MSE1.

Add a new command button to the map editor, put this in it:
Code:
Dim y As Long
Dim x As Long
For y = 0 To MAX_MAPY
    For x = 0 To MAX_MAPX
        If frmMapEditor.optLayers.Value = True Then
            With Map.Tile(x, y)
                .Ground = 0
                .Mask = 0
                .Anim = 0
                .Mask2 = 0
                .M2Anim = 0
                .Fringe = 0
                .FAnim = 0
                .Fringe2 = 0
                .F2Anim = 0
            End With
        End If
    Next x
Next y
Reply
#2
Isn't this the same as the "One-Button clear layer/Attribute button" tutorial that DarkX posted?

EDIT: I mean, I know it's different code, your's looks alot simpler, but I meant, doesn't it do the same thing?
Reply
#3
Dunno, guess there is a clear layer button. But I think his code removes the tiles from the option box thats checked. This will remove all the tiles, so you dont need to delete the map.

Just felt like posting it Tongue
Reply
#4
Just one thing for performance, replace the
Code:
For y = 0 To MAX_MAPY
    For x = 0 To MAX_MAPX
        If frmMapEditor.optLayers.Value = True Then
with
Code:
If frmMapEditor.optLayers.Value = True Then
    For y = 0 To MAX_MAPY
        For x = 0 To MAX_MAPX
This way it will not check the if max_mapy*max_mapx times... It's the same thing, but little faster(unnoticeable)...
Reply
#5
Dragoons Master Wrote:Just one thing for performance, replace the
Code:
For y = 0 To MAX_MAPY
    For x = 0 To MAX_MAPX
        If frmMapEditor.optLayers.Value = True Then
with
Code:
If frmMapEditor.optLayers.Value = True Then
    For y = 0 To MAX_MAPY
        For x = 0 To MAX_MAPX
This way it will not check the if max_mapy*max_mapx times... It's the same thing, but little faster(unnoticeable)...

Does it only loop now if the option is selected? Whereas Will's method, had it looping before it checked..?
Reply
#6
It doesnt really matter Tongue
Reply
#7
Will's checks it the condition is true every time it loops, and it will always loop, no matter what. With the If before the loops it will only loop if the condition is true, and this if it made only once.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)