Ok, so this tutorial will make it so that you can putin any size tilesheet with any width and the game will figure out its width and change TILESHEET_WIDTH accordingly. The first thing we have to do for this is make a horizontal scroll bar for our map editor, otherwise we can't use tilesheets bigger then our map editor.
Go to frmMirage,and add a new horizantle scroll bar under where the map editor tiles are. You may want to move some things down to fit this in.
Name the scroll bar hscrlPicture
now in frmMirage add this sub
Code:
Private Sub hscrlPicture_Change()
Call MapEditorTileHScroll
End Sub
We might as well also add under this line
Code:
scrlPicture.Max = (picBackSelect.Height \ PIC_Y) - (picBack.Height \ PIC_Y)
and under this line
Code:
Call InitTileSurf(scrlTileSet)
Code:
Call CalcTilePositions
These bits should make more sense later.
Now go to modGameEditors and add this sub
Code:
Public Sub MapEditorTileHScroll()
With frmMirage
.picBackSelect.Left = (.hscrlPicture.Value * PIC_X) * -1
.picScreen.Refresh
End With
End Sub
we put the picscreen.refresh in because when picbackselect goes behind picscreen it makes an ugly grey box, and its better to just refresh the whole screen. You can remove it if you want.
Now lets do the actual dynamic width part
find
Code:
Public Const TILESHEET_WIDTH As Integer = 7 ' * PIC_X pixels
comment it out, or delete it
now in modGlobals add this at the bottom
Code:
'Tilesheet width
Public TILESHEET_WIDTH As Integer
in modDirectDraw7 in the InitTileSurf sub under this code
Code:
Call InitDDSurf("tiles" & TileSet, DDS_Tile)
put
Code:
TILESHEET_WIDTH = modDirectDraw7.DDS_Tile.SurfDescription.lWidth \ PIC_X
I hope this works for you!
_________________
GIAKEN wrote:
I think what I see is this happening:
Labmonkey gets mod, everybody loves him, people find out his code sucks, he gets demoted, then banned, then he makes an engine called Chaos Engine.