Jump to content
  • Advertisement
Sign in to follow this  
onehitstudio

Help me : Scrolling 2D map

This topic is 3665 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I wrote a basic program to move a animation . I used and IDirect3DTexture9 to load sprites and ID3DXSprite to draw them. My question is "how to change my window's viewport or scrolling background"? See this picture, you can understand : http://img144.imageshack.us/img144/9863/52252519of6.jpg I already used DeviceD3DX.SetViewPort(), but it only move inside the window. Like this picture : http://img227.imageshack.us/img227/4791/13332623tw4.jpg I also tried to move all static object follow the dynamic object(game user), but i think it's not good and hard for future development. I read this techical, but it's not my case : http://www.toymaker.info/Games/html/2d_scrolling.html Please help! Thank you for your look.

Share this post


Link to post
Share on other sites
Advertisement
Usually you'd just change your camera's position.

I'm not sure I understand your problem though.

Share this post


Link to post
Share on other sites
It's easy to change position with 3D coordinate. But i only work on 2D platform, and can't use "change your camera's position" as you told.
Maybe, this problem will be fixed if i use a 2D background in 3D world(using camera). But it's not a good point, i thought so.
Thank you for your reply.
I need more help. Please care my case.

Share this post


Link to post
Share on other sites
If scrolling the background as you mentioned in the toymaker link is not what you want to do, what is it you do want to do? Perhaps you need to describe that better.

Share this post


Link to post
Share on other sites
Quote:
Original post by onehitstudio
It's easy to change position with 3D coordinate. But i only work on 2D platform, and can't use "change your camera's position" as you told.
Maybe, this problem will be fixed if i use a 2D background in 3D world(using camera). But it's not a good point, i thought so.
Thank you for your reply.
I need more help. Please care my case.
I don't follow - If you're using IDirect3DTexture9, then you're already using 3D coordinates.

Share this post


Link to post
Share on other sites
I only use that interface to import 2D sprites. You can read this to understand more:
http://www.toymaker.info/Games/html/sprites.html

As you see, in Diablo game for instance, when you move your character, every object move follow. It's easy to think that they change the window view position(I thought so). And my case, exactly, how do they do it(Only move window view position, and It won't change window's coordinate)?

Share this post


Link to post
Share on other sites
I'm not at all familiar with Diablo, other than viewing some screenshots.

However, from the screenshots, it's likely you want to use an array of sprites to form your world. Rather than changing the viewport, games like that are drawn by positioning sprites on the screen.

Below, the squares represent individual sprites you draw to the screen.

__________________________________
| | | | | | |
| | | X | | | |
|_ _ _|_ _ _|_ _ _|_ _ _|_ _ _|_ _|

If the player "moves" to the right, you actually draw the sprites a little to the left.

__________________________________
| | | | | | |
| | | X| | | |
|_ _|_ _ _|_ _ _|_ _ _|_ _ _|_ _ _|


Share this post


Link to post
Share on other sites
Yes, the way that change map tiles and other objects follow player I did.
But you know? I'm using window's coordinate to obtain something like mouse position, enemy position, building position(can't move),player's current position. And if i redraw any of them, i gotta to change all of their positions.
See it, for more clearly:
IMG link : http://img522.imageshack.us/img522/3654/73133108jp0.jpg

And if i easily can move window's view position( like change your eye pos in 2D world to see another part ), i only need to change player's position and the view pos of the window.

Thank you for your replies.
I need more help. Thanks all.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!