Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only works with map sizes that are a power of 2? #16

Open
githubaccount256 opened this issue Apr 7, 2021 · 5 comments
Open

Only works with map sizes that are a power of 2? #16

githubaccount256 opened this issue Apr 7, 2021 · 5 comments

Comments

@githubaccount256
Copy link

githubaccount256 commented Apr 7, 2021

This took me hours and hours to figure out, but it seems to be the case that this project only works with map sizes that are a power of two. That is, if your tiled map is 40x40, it just won't render anything. The map would have to be either 32x32 or 64x64.

I took a look through the demos available and sure enough, all of their map sizes are indeed a power of 2 (such as 256x256 or 512x512).

I assume this is a bug because the original algorithm from which this library was based did not have this restriction. Do you have any idea what may be causing this? None of my map sizes are of a power of two unfortunately, so they all currently render blank.

If this is not a bug but is indeed just a restriction of the library, I believe it should be noted somewhere, as this took me 6 hours to figure out.

@englercj
Copy link
Owner

englercj commented Apr 7, 2021

Sounds like a bug, I haven't looked at this lib in over a year. PRs welcome.

@githubaccount256
Copy link
Author

githubaccount256 commented Apr 7, 2021

Ah, do you have any idea what or where it might be? I'm not the best programmer and some of this code is very overwhelming to me. If you could perhaps narrow it down then maybe I'd have more luck? Because as it stands I'm not sure if I could solve this..

@githubaccount256
Copy link
Author

githubaccount256 commented Apr 7, 2021

Oh, progress! It looks like changing private _repeatTiles = true; to private _repeatTiles = false; fixes the problem!

@englercj
Copy link
Owner

englercj commented Apr 9, 2021

There is a public setter for that which is used in the demo:

tileMap.repeatTiles = false;

@englercj
Copy link
Owner

englercj commented Apr 9, 2021

Make sure to use the setter, and don't just change the private because it needs to setup the texture correctly if we're not repeating tiles.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants