I'm trying to make a 3D game with some 2D qualities as well. The 2D part of the game is building your own level out of tiles as a sort of map.
Anyways, I want to stick to using IGUIImage for a function I am using a ton of, and cannot get the tiles part to work.
I currently have so you can select a tile on a tilemap, then place that tile down. But thing is, the tile is not selecting properly.
Here's my code:
Code: Select all
tiles.push_back(env->addImage(core::rect<s32>(srcX,srcY,srcX+tilesWidth,srcY+tilesHeight)));
tiles[tiles.size()-1]->setImage(driver->getTexture((char*)IMG.c_str()));
Each tile is 16x16, and no matter what, I can't get it to drop the tile you selected.
If I change it to something like core::rect<s32>(0,0,32,32) the tile will be a rectangle from the tilemap of the square starting at 0,0 and ending 32,32, which is fine.
But if I change it to something like core::rect<s32>(32,32,64,64) It's the same tile as 0,0,32,32???
That doesn't make sense to me.
Any suggestions on how to fix this issue?
Thanks!