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

Non-orthoganal grids #120

Open
3 tasks
rolopogo opened this issue Oct 27, 2024 · 2 comments
Open
3 tasks

Non-orthoganal grids #120

rolopogo opened this issue Oct 27, 2024 · 2 comments
Labels
enhancement Improvement to existing capability

Comments

@rolopogo
Copy link

Check ([ ] -> [x]) all that apply, then describe the issue below:

  • I have searched the tracker for similar issues (including closed ones)
  • I have provided a detailed example for how this feature should work
  • I have provided a use case for this feature, e.g. short description/share link of a game you're making and how you'd use the feature in that game, other things you've tried, edge cases, etc. (if applicable)

Allow grid cell position to be offset per row and per column

Grid offsets could be used by games that use fake perspective,
Grid offsets could also be used to create isometric tiles, hexagonal tiles more easily than creating split sprites that span multiple tiles

Implementation:
Add grid_offset_per_row and grid_offset_per_col to allow grids to be transformed into different layouts

In graphics.js getDrawPos, modify offs.x and offs.y by some factor of ij.y and ij.x respectively
e.g.

const offs= {
x: obj.spriteoffset.x +  (state.grid_offset_per_row*ij.y),
y: obj.spriteoffset.x +  (state.grid_offset_per_col*ij.x)
}

Large offsets will change the total grid proportions, so adjustments should also be made to sections computing world bounds.

@rolopogo rolopogo added the enhancement Improvement to existing capability label Oct 27, 2024
@rolopogo
Copy link
Author

For hexagonal grids we would need to negate the grid offset every other row. Not sure how best to handle this in config.
Maybe something like defining a pattern grid_offset_per_row 4,-4

@david-pfx
Copy link
Owner

I'll look into it.

But hexagonal is another thing entirely.

david-pfx added a commit that referenced this issue Oct 30, 2024
Fix tooltip text resolution
Partial fix for tagged object overwrite bug (see Hebird)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improvement to existing capability
Projects
None yet
Development

No branches or pull requests

2 participants