Hi guys, I am developing a Stardew Valley like 2d pixel game.
Now I have a confused point to figure out. What should I do to keep record of each items' location, and when I instance new item on the ground, they won't overlap.
For example, at (16,16) I placed a corn seed which occupy 16 * 16. And if I place another cord seed on this spot, it should reject. What should I do to apply this logic to this game?
My thoughts so far:
create a data structure to keep record of all items' location and their size, when instancing new object, check this data structure to make sure the position I am going to place has no conflict.
Is there any other thoughts that makes more sense? or do you know how Stardew Valley handle this?
Best,
Peter