![]() |
[Feature] Dynamic Tile Width - Printable Version +- Mirage Source (https://mirage-engine.uk/forums) +-- Forum: Mirage Source (Nostalgia) (https://mirage-engine.uk/forums/forumdisplay.php?fid=61) +--- Forum: Archive (2006-2011) (https://mirage-engine.uk/forums/forumdisplay.php?fid=18) +---- Forum: Source Code Development (https://mirage-engine.uk/forums/forumdisplay.php?fid=51) +----- Forum: Mirage Source 4 (Visual Basic 6) (https://mirage-engine.uk/forums/forumdisplay.php?fid=44) +------ Forum: Tutorials (https://mirage-engine.uk/forums/forumdisplay.php?fid=13) +------ Thread: [Feature] Dynamic Tile Width (/showthread.php?tid=2745) |
[Feature] Dynamic Tile Width - Labmonkey - 13-04-2009 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() 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() 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 now in modGlobals add this at the bottom Code: 'Tilesheet width in modDirectDraw7 in the InitTileSurf sub under this code Code: Call InitDDSurf("tiles" & TileSet, DDS_Tile) Code: TILESHEET_WIDTH = modDirectDraw7.DDS_Tile.SurfDescription.lWidth \ PIC_X I hope this works for you! Re: [Feature] Dynamic Tile Width - jaheoo - 17-07-2009 Run time error 11: Devision by zero It highlights in the modgamelogic module also in the Public Sub CalcTilePositions() "MapTilePosition(X, Y).Ground.Top = (Map.Tile(X, Y).Ground \ TILESHEET_WIDTH) * PIC_Y" Re: [Feature] Dynamic Tile Width - Egon - 17-07-2009 jaheoo Wrote:Run time error 11: Devision by zeroMake your TILESHEET_WIDTH not equal 0 pixels wide then... Or make sure it's named as "tiles" Re: [Feature] Dynamic Tile Width - jaheoo - 17-07-2009 How do I make sure the TILESHEET_WIDTH is not equal to 0 pixels wide? Through the code or through the properties? Also I have named the tilesheet Tiles1 because the latest version of mirage has already built in Tiles1 and Tiles 2 you can use. Re: [Feature] Dynamic Tile Width - genusis - 21-07-2009 This may be stupid but why Dynamic tile width why not Dynamic maps which would be much better. Re: [Feature] Dynamic Tile Width - Rian - 21-07-2009 genusis Wrote:This may be stupid but why Dynamic tile width why not Dynamic maps which would be much better. Two completely different things. Re: [Feature] Dynamic Tile Width - genusis - 21-07-2009 im just saying since Dynamic tiles seem kind of pointless XD. Re: [Feature] Dynamic Tile Width - Beres - 21-07-2009 How is it pointless? Its purpose is that you don't have to edit your tile sheets to fit the size Mirage uses. I don't find it pointless. |