MapX = XPos / m_Tiles->GetWidth(0);

Started by
1 comment, last by OB1st 21 years, 6 months ago
MapX = XPos / m_Tiles->GetWidth(0); This is from prog RPG book. This is a single line of code from cMap class of chapter 11. m_tiles is a member of type cTiles. GetWidth(0) returns the width of the tile. My question is why passing a(0) rather than a variable? Does it mean that the tile width is the same for all the tiles we intend to draw. Sorry for not being able to explain the question any better, otherwise the question will be long and I have to post lots of code. Thanks
I would love going home to M7, but I can't detect black holes.
Advertisement
you say that GetWidth(0) returns the width of the tile,

if that is so then why does it need input ''0'' at all?

find out what the parameter is for, and you will find out why it is always 0 :-)


Raymond Jacobs,
Profesional Web Applications Developer,
Weekend Game Developer,
www.EtherealDarkness.com

Raymond Jacobs, Owner - Ethereal Darkness Interactive
www.EDIGames.com - EDIGamesCompany - @EDIGames

The parameter of that function is the texture number to check. The cTiles class allows multiple textures to be loaded, but the cMap class only uses the first one, so it always checks texture 0.
__________________________________________________________America seems to like crap because its what we make popular. - Goober King

This topic is closed to new replies.

Advertisement