Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Tiling#13

Merged
gampleman merged 8 commits intomasterfrom
tiling
Apr 3, 2019
Merged

Tiling#13
gampleman merged 8 commits intomasterfrom
tiling

Conversation

@gampleman
Copy link
Contributor

@gampleman gampleman commented Mar 19, 2019

Implements tiling of all layers. Closes #3.

@gampleman gampleman requested a review from cleanasmud March 19, 2019 11:19
Copy link
Contributor Author

@gampleman gampleman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bit of a walkthrough through this PR.

@gampleman gampleman requested review from AnjaB and marksmall March 28, 2019 16:39
@gampleman gampleman changed the title Tiling [WIP] Tiling Mar 28, 2019
});
}

computeLoadableTiles() {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function just wraps a call to one other function, would it not be better to just call it directly?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This get's overridden in one of the child classes. I will add a comment about that.

Copy link

@marksmall marksmall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple of comments, more points to ponder. There is a lot of maths with numbers passed in (I made a comment about this). I find it difficult to understand what they mean so making them constants might help there, I'll leave that up to you as it could mean a lot of refactoring.

if (br.x > 1 && br.y > 1) add(t.neighbor(1, 1));

if (tl.y < 0) add(t.neighbor(0, -1));
if (br.y > 1) add(t.neighbor(0, 1));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be better making the values checked against and those passed to neighbour, constants, would give these if statements more context. Basically I'm not sure in this situation what -1, 0, 1 represent.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Their offsets of the tile. So given tile z=3, x=2, y=1:

  • tile.neighbor(0, 0) == tile == 3/2/1
  • tile.neighbor(1, 0) == 3/3/1
  • tile.neighbor(0, -1) == 3/2/0

and so on.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A comment to that effect would be good then, if others have to support this, its likely to only be every few months anyone will look at the code and this isn't info I at least will remember or clean from the code.

src/tileID.js Outdated
return this.parent()
.children()
.filter(t => !this.isEqual(t));
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could use a tertiary if here to make it more terse.

@gampleman gampleman merged commit 6e046e1 into master Apr 3, 2019
@gampleman gampleman deleted the tiling branch April 3, 2019 09:59
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.

3 participants