Tile Based Question
Hi all,
I have been working on a Tile Based game for fun, I''m not really a programmer, I''m a designer, but I figured I would give it a shot
I finished the game, now I am working on the Map Editor. What I want to do, is display the tiles on the right hand side of the screen, then using hte mouse, click on a tile, that tile sits on the cursor and can be moved around (into the correct place) and clicked to be placed.
I have 3 surfaces, the tileset surface, the background and I created a surface for the tile that will sit on the mouse. Then, I take the mouse coordinates, and create my RECT for the blit from the coords (x, y, x+32, y+32), then blit the tile into that rect.
The problem is, in the initialize, I load the tileset bitmap into the surface, the background bitmap into the background surface. I wasnt sure what to do with the tile on the mouse cursor, so I loaded the tileset bitmap into that surface. I can select the correct tile, and blit it, but it just seems to want to stay in the top right hand corner of the screen, no matter where I move my mouse. I am including code showing the loads and the render loop...
Surface inits
if( FAILED (lpdd7->CreateSurface(&ddsd, &lpddsTileset, NULL)))
return(FALSE);
if( FAILED (lpdd7->CreateSurface(&ddsd, &lpddsBackdrop, NULL)))
return(FALSE);
if( FAILED (lpdd7->CreateSurface(&ddsd, &lpddsMouseDrag, NULL)))
return(FALSE);
if(!Load_Bitmap(MAKEINTRESOURCE(IDB_BACKGROUND), 0, 0, lpddsBackdrop))
return(FALSE);
if(!Load_Bitmap(MAKEINTRESOURCE(IDB_BITMAP1), 0, 0, lpddsTileset))
return(FALSE);
if(!Load_Bitmap(MAKEINTRESOURCE(IDB_BITMAP1), 0, 0, lpddsMouseDrag))
return(FALSE);
The main render loop (mMouse is my encapsulated mouse class using direct input)..
mMouse.Update();
RECT rcDest3;
rcDest3.top = mMouse.GetYAxis();
rcDest3.bottom = mMouse.GetYAxis() + 32;
rcDest3.right = mMouse.GetXAxis() + 32;
rcDest3.left = mMouse.GetXAxis();
byTile = byMap[0][1][0];
lpddsBack->Blt(&rcDest3, lpddsMouseDrag, &lptile[byTile]->rcLocation , DDBLT_WAIT, NULL);
Any help would be awesome guys, been working on this way to long
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement