Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

OB1st

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

This topic is 5727 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!