parsehex / incremental-forest

Chop down trees, sell logs and hire workers to chop more trees.
https://parsehex.github.io/incremental-forest/
MIT License
0 stars 0 forks source link

In-between-tile placement #20

Closed parsehex closed 7 years ago

parsehex commented 7 years ago
screen shot 2017-06-25 at 11 43 22 am screen shot 2017-06-25 at 11 43 32 am

Has happened more than once in same playthrough.

It appears the object still has the correct tile set and the world is still keeping track of it correctly. The object is just placed at coordinate that was not tile-adjusted (add 16px to coordinates).

parsehex commented 7 years ago

I wonder if it could be that pine cones are placed in the middle of the cursor's graphic moving? Pine cone placement is based off of {x, y} = cursor.graphic, so if the graphic's coords are in the middle of tweening it would make sense that pine cones (or any placeable item) could be placed off-grid.

This wouldn't explain though why the "between-placements" are always exactly between tiles instead of a more random offset (which would be likely if the coordinates are mid-tween). In sprites/Common, all sprites are "aligned" to the world with a lazy line:

const alignedCoords = alignToGrid({ x, y });

I've known for a while that this function will return coordinates that are not actually aligned to the grid. All it does is ensure that the coordinates are divisible by 16, causing these misplacements to either align to the center of a tile, or the center of two tiles.

Will see if I can replicate this to some extent so I can make sure it's fixed.

parsehex commented 7 years ago

Looks fixed