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

Tilemap.swap() doesn't behave according to the documentation #1034

Closed
noidexe opened this issue Jul 16, 2014 · 1 comment
Closed

Tilemap.swap() doesn't behave according to the documentation #1034

noidexe opened this issue Jul 16, 2014 · 1 comment

Comments

@noidexe
Copy link
Contributor

noidexe commented Jul 16, 2014

This is what it does according to the official documentation:

//Scans the given area for tiles with an index matching tileA and swaps them with tileB.    
swap(tileA, tileB, x, y, width, height, layer);

And this is from the examples

//  This will swap every instance of tile 30 (empty ground) with tile 31 (the cactus plant), it also does the opposite,
//  so tile 31 (cactus plants) will become empty ground (tile 30). It does this across the whole layer of the map.
map.swap(30, 31);

What it actually does is neither. It just turns every instance of tileB it finds into tileA.

I think this was changed in #544 and probably many people have coded their games expecting this behavior, so maybe it's easier to just change the docs.

However, I think it was working correctly before #544, or at least I find the previous behavior very useful in some cases, so it would be nice to have another function using the old swap() behavior.

@photonstorm
Copy link
Collaborator

Ahh, the swapHandler just need an else if and it would have worked fine. I'm going to change this anyway because it wasn't working correctly before.

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