Need help with 2D Map in Managed Direct X

Started by
1 comment, last by Holy Fuzz 19 years, 4 months ago
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
Advertisement
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.
Mykre - BlogVirtual Realm :- XNA News and Resources from Down Under** For those Interested in an Australian XNA User Group Contact me though my site.
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

This topic is closed to new replies.

Advertisement