Sign in to follow this  
dhartles

Need help with 2D Map in Managed Direct X

Recommended Posts

OK, I'm new to Direct X (2 weeks), but I've made it through several books (Tom Miller's Kickstart), and .NET Game Programming with DirectX 9.0(Managed). I've decided to get my feet wet with a 2D engine(game) before making the leap to 3D. I've gotten to the point where I can generate a tile type map that is comprised of sprites (created by a class) that are stored into a 2 dimensional array. What I would like to know is can the camera angle (transform.view) be changed to represent more of a 45' perspective vs. the top-down view that is currently the default. My understaning from TM's book, is that the sprite objects in MDX are constructed the same way you would create a 'flat' 3D rectangle. If this is the case shouldn't I be able to rotate either the camera around the sprites that make up my map (or rotate the sprites themselves?). Thanks in advance. Dave

Share this post


Link to post
Share on other sites
Have not tried it but sounds fair, might have to give it a go this weekend.

If so you should just change the cameras view point to change the way it looks.

Share this post


Link to post
Share on other sites
The simple answer is yes, you can. At it's most basic, you simply use the view/transform matrices to change your view of the map.

HOWEVER... If you have a pretty large map, you will want to only draw what the user can currently see on the screen, otherwise the game will run much slower than if you draw the portions of the map that are off the screen. (this is true regardless of the map perspective). It's very easy to figure out which portions of the map need to be drawn when the user is looking straight down at it, but it's more difficult when you use a different perspective, and much more difficult if you let the user dynamically change the perspective. You may want to look into BSP Trees and Viewing Frustrums.

Also, perspective can of course also be achieve by simply using artwork already created to look like it is in the proper perspective.

- Fuzz

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this