Closed Godnoken closed 6 months ago
You could change the world origin in the HexLayout
to offset everything, but if you are using the shapes
module you might need to rewrite the rectangle function to do what you intend and offset all hexagons to avoid negative values, this combined with the origin
change would make a centered rectangle
Thank you! I will look into it.
Hi,
I have two issues;
The first one is that I am struggling to center a 15 by 11 sized pointy_rectangle.
The only way I manage to do so at the moment is by doing something like
shapes::pointy_rectangle([-7, 7, -5, 5])
. It does center it, however, the x, y coordinates I receive are not desirable in that solution. I don't want any negative x, y, but 0-14 and 0-10 instead.Is there an easy way to solve this? I assume it would involve not using
hex_to_world_pos
.Edit;
I 'solved' the first problem by continuing to use
[-7, 7, -5, 5]
with
and inverting x, y on the layout so I can present 0,0 in the top left corner of the rectangle and 14, 10 in the bottom right.
Of course, this is purely to visualize the tile's x, y with text, and I continue to use the
[-7, 7, -5, 5]
coordinates for the position.Not ideal but it works for my purposes.
The other issue is that the visual placement is for some reason not the same as the coords that
handle_input
picks up (taken from "field_of_movement" example). It's off by 1 tile, as if there's another outer layer of hexagons. Maybe that's by design from the example and I just don't see where?Thank you so much for this amazing crate! Let me know if I need to clarify anything.