MadMartian / hydrazine-path-finding

A rather basic A* path-finding engine inspired by a certain blocky sandbox game that everyone has played before
Other
22 stars 3 forks source link

2D Usage #3

Closed DrOreo002 closed 3 years ago

DrOreo002 commented 3 years ago

Hey, do you have any working example for 2d world usage? I kinda struggled to get it working

MadMartian commented 3 years ago

No working example, no... you could definitely achieve this though by how you implement the columnar spaces, which report where the "blocks" (solid ground / obstacles etc) are.

I would achieve this by pretending the world exists at y-level 64, then model obstacles as things that are at least two "blocks" high reaching to y-level 66. If the engine requests "blocks" at y-level 64 and below then return something solid, above 64 then return something indicating "air" or open space (except for your obstacles).

Then for the 2D entities, you would report their coordinates (to the path engine) as < x, 65, z > so that they're sitting on-top of the flat world that exists at y-level 64.