![]() |
Scrolling maps (Not 100% Working) - Printable Version +- Mirage Engine (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: Resources (https://mirage-engine.uk/forums/forumdisplay.php?fid=49) +---- Thread: Scrolling maps (Not 100% Working) (/showthread.php?tid=234) |
Scrolling maps (Not 100% Working) - Krloz - 12-08-2006 Difficulty: Medium 3/5 Credits : Missunderstood , Verrigan This tutorial will show you how to modify a vanilla copy of Mirage Source 3.0.3/3.0.7 to put in scrolling maps. This has only been tested on vanilla Mirage Source 3.0.3/3.0.7, and is not guaranteed to work with your code. Me : Krloz tested it on a blank MSE and it worked but with the bug mentioned on the bottom With my version of scrolling maps, the player will always be in the center tile of the screen. (Or 1 left/1 up from center, depending on how big you make your maps. x = 8, y = 6 on standard vanilla 3.0.3/3.0.7) Any tile that is off the map will be filled with black. Files to Modify [*]modGameLogic.bas Each portion of this tutorial is broken up by file, which is how I intend to break down every tutorial I post on this forum, even in cases such as this one that we only modify one file. If enough people want to see this in action before making changes, I may put up a temporary (vanilla) server/client.. Anyways.. Let's begin. modGameLogic.bas ModGameLogic is where the game handles all of the imagery that you see in the game. I'm going to show you from the top of the file to the bottom. In Sub GameLoop() Replace this code: Code: ' Release DC With this code Code: ' Release DC In Sub EditorMouseDown Replace this code: Code: Public Sub EditorMouseDown(Button As Integer, Shift As Integer, x As Single, y As Single) With this code : Code: Public Sub EditorMouseDown(Button As Integer, Shift As Integer, x As Single, y As Single) In Sub PlayerSearch Replace this code: Code: Sub PlayerSearch(Button As Integer, Shift As Integer, x As Single, y As Single) with this Code: Sub PlayerSearch(Button As Integer, Shift As Integer, x As Single, y As Single) Delete this code: Code: ' Blit the text they are putting in Under this code: Code: ' Blit the backbuffer Add this code: Code: ' Blit the text they are putting in Quote: his tutorial has been tested in vanilla 3.0.3/3.0.7, and works great. I'm sure there are other ways to do this, and maybe even cleaner ways, but it works great for me. The only bug I see is when u use 25+ X,Y's the player moves out of the screen and you wont be avaible to see your char still messing to see how to fix it - Misunderstood - 12-08-2006 Sync didn't do it, he just moved it to the old forum, Also credit verrigan, its modified(and Improved ![]() There may be some bugs, I have them fixed in my sources, so if you encounter them, let me know and i'll be able to fix it. - Krloz - 12-08-2006 Well yes I made my maps bigger but I just cant get it working because the char wont go in the middle of screen for example maps X = 30 Y = 25 __________________ | | |  | | | | | | | |  | |________________X| - Misunderstood - 12-08-2006 uhh...thats never been an error I have encountered...It seems like you might have done something wrong. This halfs the map_x and y to get the middle, so changing the map size wouldn't through it off. It uses the constants, not fixed values.(I might have used 32 instead of pic_x in some places though, not sure) - Misunderstood - 12-08-2006 it would just round it. I wouldn't think it wouldn't through it off by several tiles. - Matt - 16-08-2006 No, having it odd, throws it off by only 1 tile. He messed with something else, apparently. No clue what it could be, unless he hasn't resized his picscreen. Which would put it down there, if it wasn't the exact size of the maps and such. - Krloz - 26-08-2006 Idk.. Map size is at default and I dont know how to fix this xD I might redo this - Matt - 27-08-2006 I'm using it in my source. You really only need to re-dim some stuff, and pass off the x and y offsets to the subs that blit things and what not. - Krloz - 27-08-2006 The thing... is that I dont know how to reDim , gilgamesch told me to reDim but Idk how xDD I guess I have to rip it off kite's wind wisper ![]() - Misunderstood - 27-08-2006 http://fuckinggoogleit.com ![]() - Matt - 27-08-2006 Lol, it's not hard. I had some help with it, but after seeing how it's done, it's really not that hard. Here is an example: Code: ReDim SMaps(Size).Tile(0 To MAX_MAPX, 0 To MAX_MAPY) Which goes in: Code: Sub iLoadMap Of course, there are more places that this is needed, well, not this exact redim, but I'm sure you guys get the point. - Krloz - 02-09-2006 I made the maps stop scrolling when they get to certain point but the characters "jump" the animations wont be working... Im still working on fixing this but Im not a pro yet xD as for the rediming im not going to do yet since im trying to make the scrolls stop in a certain point - Matt - 02-09-2006 If this is Misunderstood's tut, then it already stops, if there is no map attached. - Krloz - 02-09-2006 This one dont stops... theres no loading of surrounding maps or anything else it just scrolls - Matt - 02-09-2006 Okay, then add this code, somewhere in gameloop: Code: If Map.Up = 0 Then This will make it stop scrolling, if there is no map linked in any direction. - Leighland - 04-09-2006 Just read through quickly but it doesn't seem anyone explained this: When you change the values for MAX_MAPX and MAX_MAPY you also need to resize picScreen. So, if you changed it to this: MAX_MAPX = 25 MAX_MAPY = 30 then you need to do this: 25x32=800 'Multiply MAX_MAPX by the width of your tiles 30x32=960 'Multiply MAX_MAPY by the height of your tiles Change the height and width of your picScreen to those values: picScreen.height = 960 picScreen.width = 800 For those of you who don't know how to do this... open up frmMirage. Left click on picScreen. In the attributes list, look for height and width and change to these values. Otherwise the character sprites disappear as a result of walking on tiles that exist but can't be seen. I assume that's why you would be losing the sprites and not getting any compiler errors. - Krloz - 07-09-2006 >.> I see then I need the same picscreen size as my maps... so I cant have bigger maps than my own screen? =( - Misunderstood - 07-09-2006 You can. Its very easy, but you need to figure out what to modify yourself. Its easy if you understand the tutorial ![]() - Leighland - 08-09-2006 I imagine you can make it bigger that your maps, I just know that it for sure cuts off the right and bottom tiles and and anything else that is supposed to be blt'd to the screen if your picScreen is too small width or height wise. EDIT: I'll test it and post results RESULTS: Well I tested simply drawing a map, running the game, walking to the edges of the screen etc. It works like it's supposed to. I then resized the picScreen to "unofficially" add another row of tiles... I could not walk on those tiles. Making the picScreen smaller does exactly what I said it would. The character appears to walk off the screen, but with a long name, you can see that is simply walking onto the tiles that are there, but cannot be seen as a result of the picScreen being too small. I tried drawing a map on the "unoffically" added tiles, and the map editor will not allow drawing. So all-in-all, my tests only proved what I allready know. Changing the size of picScreen only effects what is displayed, and what is not. The variable checking that was added to the source code prevents any errors from occuring, so what's why your character would be disappearing off the screen without any real debug info. In the compiler's eyes, there is nothing wrong with the code, and since the tile exists in code, it will place the character on them anyways, even though the tile cannot be visually seen. Now with the scrolling maps, as said above... if you know how to modify it slightly, you can have bigger maps than your picScreen, you just need to know how to display them... and unfortunately I don't lol. I hope this helps explain some things for you. - William - 14-09-2006 Since it is not 100% working, im moving it under requests for now ![]() ![]() - Krloz - 15-09-2006 Ok shannara... @topic... I tried messing with code all I could is blting the char on center of screen ( +2y of the center but I could.. ) except I couldnt made it to work properly when I try to map and everything the char still working as if its lost on the map[/quote] |