Skip to main content
gamedev.net
🔒 Locked

Side Scrolling ect..

Started by DevLiquidKnight Aug 10, 2002 at 6:43 PM 3 replies 200+ views
Original Post
DevLiquidKnight
DevLiquidKnight
I have a map that is loaded into a seprate directx surface and im trying to figure out exactly how to move around on it i can load it up on a normal 640, 480 surface and veiw it. One way i tried was by doing this I made the map surface(1024, 1024) witch is the size of the map. Then I put each tile(10, 10) into the map each tile is located on the map and I raise the x, y corridnate by having a loop that goes through and does iteration*10 to get the x, y. Then after they are loaded onto the surface i had it so when the player moved it changed the x and y offset of the map and changed the Rect Displayed on the sceen like this RECT rcRect; rcRect.left = Map.xOff; rcRect.top = Map.yOff; rcRect.right = Map.xOff + 640; // 640 is screen width rcRect.bottom = Map.yOff + 480; // 480 is screen height Then I blt the screen of the map to the back buffer surface and flip that with the primary(only once frame is done being made) its not working for some reason can someone help? Also am I even going into the correct direction im quite sure the loading of the map is correct but the whole way im moving the tiles around doesn''t seem to work very well. Can someone tell me if I am or not or of a place to find the correct way to do it or even just explain here.
iwasbiggs
iwasbiggs
What doesn''t work? Find out which function fails.

If none of them give errors then make sure you''re loading the map properly.

Freeware development:
http://www.ruinedsoft.com/
___________________________Freeware development:ruinedsoft.com
DevLiquidKnight
DevLiquidKnight
Ok i got it to work kinda but now im experancing a new problem the map is loaded to the screen and u can see it and it scolls up down left right.

Once it gets past 640 in width or 480 in height it makes the surface containing the map data disspear when i go back to values within that range it reappears?

How can i fix it so it remains on the screen till u scroll to the other side?

Im thinking maybe if i take the surface with the map data in it and blt it to another surface that is 640, 480 and then blt that surface to the back buffer it might work but I dont know?

[edited by - DevLiquidKnight on August 10, 2002 9:38:58 PM]
Colin Jeanne
Colin Jeanne
IIRC, if you try to blit with any part of your rect off screen then nothing will be drawn. I had a similar problem in my DDraw 2D sidescroller engine that I never got around to fixing. The solution is simple, draw only the part of the rectangle that is visible.



I will not make a list of links... I will not make a list of links... I will not make a list of links...
Invader''s Realm

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.