Computer Science Canada Working with big maps... |
Author: | TokenHerbz [ Fri Mar 03, 2006 3:08 am ] | ||
Post subject: | Working with big maps... | ||
Normally when i am useing maps, ill screenshot them so there much faster to reload... But, how do i make a big map fast especially when you want to move it? if you screen shot it, and move the map, theres no variable and crash, without screenshot, its so slow and laggish... I need some opinions, Heres my example:
**add your text file 100x100 w/ spaces : eg: 0 0 0 0 0 0 |
Author: | Delos [ Fri Mar 03, 2006 10:20 am ] |
Post subject: | |
Your problem is two fold: - as you mentioned, using a pic stream (ScreenShot) causes an error. This error is quite simple: the bounds of your picture are off the screen! So, instead of starting with the pic at (-20, -20), draw it at (0, 0) (with the screen sized so that it perfectly fits the picture), take a screenie of it (from (0, 0) -> (maxx, maxy)) and store that in ScreenShot. - now, in your loop, remove all calls to draw_map(), and instead have a single call drawing ScreenShot at (mapx, mapy) outside of the if-structure. Add in the necassary View.Updates, delays, and cls and you're good to go. |
Author: | TokenHerbz [ Fri Mar 03, 2006 10:51 am ] |
Post subject: | |
Delos i attempted this, when i move the cursor to the right, that map is supposed to move to the left, thus revealing more of the map (like in Brood War) . thats when i get errors... |
Author: | Delos [ Fri Mar 03, 2006 11:13 am ] |
Post subject: | |
Code please...(I've tried it and it works, so perhaps you're doing something wrong.) |
Author: | TokenHerbz [ Fri Mar 03, 2006 11:22 am ] |
Post subject: | |
i get errors when i move the screen to a direction greater then the max |
Author: | Delos [ Fri Mar 03, 2006 5:41 pm ] |
Post subject: | |
Ok, I'll try be a little clearer this time: I've editted your code and got it to work, doing exactly what you wanted it to. Now, to be able to help you do the same, we would need you to post your updated code. Your saying something to the effect of: Quote: ...to a direction greater then [sic] the max... is really hard to work off. Max-what? 'maxx', 'maxy', the edge of your screen, the size of your map? See what I mean. Posting code, along with a description of your errors, why you think you're getting them, and other relevant info makes helping you so much easier. |