Skip to content

Conversation

@GaryCXJk
Copy link

The Tiled plugin has a handy feature called levels, where you're able to switch layers to get different layers of collision. Unfortunately by default this feature does not exist in this plugin, as the entire collision mesh immediately gets rendered.

This is why I've modified the code to support multiple levels. It will now generate a new mesh for every level.

There's also an extra functionality added for a modification of Tiled which would allow people to enable and disable layers based on certain conditions. It should however be fully compatible with the current official build of Tiled.

@felixjones
Copy link
Member

I need to check this against my test project to make sure nothing is broken and that no unexpected (or non-vanilla) behaviour is introduced.

How much of this depends on a particular TileD Plugin? I'd like to keep dependencies on TileD Plugins data based, rather than method based, so if methods are changed we won't inherit new behaviour. TileD data is unlikely to be changed as there is a shared dependency with the TileD JSON specification.

I am not a fan of using the number of arguments to branch behaviour. I'd rather have multiple methods, than branch based on arguments.length - extract shared behaviour into additional methods. This might be slower, but I think it is easier to follow and is generally more flexible. For example; if we wanted to change the method arguments, perhaps add a new one or rename one of them, then the arguments.length usage could break quite badly.

I don't mind parsing the arguments array, though - as part of variadic arguments style behaviour - but branching based on arguments.length is something I'm not comfortable with.

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

Successfully merging this pull request may close these issues.

2 participants