What this system aims is to provide a performant way to iterate through stars for hovering animations;
The idea is the following:
- Create a grid of chunks of
64 x 64 pixels.
- Assign stars to a chunk depending on its position
grid[(star.x / 64) | 0][(star.y / 64) | 0] .
- For star finding algorithm look on the chunk on which the pointer is on
grid[(p.x / 64) | 0][(p.y / 64) | 0] and look on nearby chunks depending on if the look-up distance is outside of the main chunk bounds.
What this system aims is to provide a performant way to iterate through stars for hovering animations;
The idea is the following:
64 x 64pixels.grid[(star.x / 64) | 0][(star.y / 64) | 0].grid[(p.x / 64) | 0][(p.y / 64) | 0]and look on nearby chunks depending on if the look-up distance is outside of the main chunk bounds.