Fix: .png files are placed out of order when calling the walk() method
joewab opened this issue · comments
I was having trouble rendering the map correctly because the graphics from the objects folder were being listed out of order when using the walk() method. I'm not sure if the Tile program somehow inserts index numbers into the png files, but the file names were not enough to impose any kind of ordering in and of themselves. So, for example, when the objects map called for 14 to be rendered, it instead rendered 10.png since the list that was created was not in any numerical order. (although it didn't seem random, it was always in the exact same incorrect order). Anyway there's an easy fix with the sorted() method:
![Screen Shot 2024-03-18 at 8 22 09 PM](https://private-user-images.githubusercontent.com/45957019/313882765-ba5274d0-810c-421a-887c-948ea2c17286.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQ2OTMzMTcsIm5iZiI6MTcyNDY5MzAxNywicGF0aCI6Ii80NTk1NzAxOS8zMTM4ODI3NjUtYmE1Mjc0ZDAtODEwYy00MjFhLTg4N2MtOTQ4ZWEyYzE3Mjg2LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MjYlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODI2VDE3MjMzN1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTg5MjZmODBhODFmNThiYmE2MDRkMjk1N2FiN2E5NDVlYjEwYjhkMjcyYzIwM2ZmZjhmZTEzZTVjZjZiZTc2MGEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.RCnE3WI4kczYgE2wSgJKK1UAddDWkDH3eFGxUKqT7ps)
I struggled trying to figure out why this was happening for a long time. I hope this helps somebody. I would have submitted a PR but I'm not sure how that would be done with this repo that is just zip files...