Advertisement

Tiling and Zooming with DirectX

Started by February 24, 2000 06:01 AM
0 comments, last by esd 24 years, 6 months ago
Hi! I´m making a 2D boat racing game. You will be able to race around islands. Now I have 2 problems: 1. The game will be tile-based but I don´t know how to to tiles. I have searched after good tutorials that explains everything. I´m a beginner at this. It can´t be isometric viewed. It have to be straight from top. I mean, I don´t understand this with creating own Leveleditors and getting the levels into the game. And that some tiles are walkable but other are not. I need help. 2. I want the game zoom out when you´r going straight forward. Maybe you have played GTA, Grand Theft Auto. There the game zooms out when you are going fast straight forward. How is that done in 2D. The Zoom fuction. I´m making this game with DirectX. Thank you!
First of all, there is no need to post the same question more than once. Post it in the forum that best matches your question.

1. For simple maps you can create the map like this:

unsigned char Map[5][5] = {
{0x88, 0x82, 0x82, 0x82, 0x81},
{0x87, 0x01, 0x01, 0x01, 0x83},
{0x87, 0x01, 0x01, 0x01, 0x83},
{0x87, 0x01, 0x01, 0x01, 0x83},
{0x86, 0x85, 0x85, 0x85, 0x84}};

0x01 = water, 0x8? = land with water

I have assigned the most significant bit to tell if the tile is walkable or not. If it is set it is not walkable.

if( Map[x][y] & 0x80 )
// The tile is not walkable

Of course later on you will want to load the map from a file instead, but that is a different story and one you don't have to dwell upon just yet.

2. IDirectDrawSurface7::Blt() can resize the area that are blitted to the screen. You do this by setting the destination rectangle to be smaller than the source rectangle. This gives the effect that the camera zooms out.



Edited by - Spellbound on 2/24/00 9:40:30 AM

This topic is closed to new replies.

Advertisement