Commit Graph

14 Commits

Author SHA1 Message Date
HyperOnion 171d78adb0 clean up world constants to make more sense.
create a constant that represents the amount of tiles a box extends out
from its center in all 4 directions. compute the box size and box center
position constants from this new constant, instead of having them be
hard-coded.
2023-06-28 16:16:26 +02:00
HyperOnion 7c7d939905 add world utility function for setting tiles to empty. 2023-06-28 15:15:19 +02:00
HyperOnion b886a3a965 make representation of empty tiles consistent.
previously, world generation would represent empty tiles as the number
0, while other code would expect them to be an object with its `type`
property set to `"empty"`. the object representation is now used
consistently.
2023-06-28 15:15:19 +02:00
HyperOnion 1c79bca1c9 track nesting depth in boxes. 2023-06-28 15:15:19 +02:00
HyperOnion 5643fd86e2 fix world save & load bug.
previously, serialization of world data couldn't handle boxes, since
they contain references to their parents, meaning worlds are cyclic.
this commit fixes this, and changes world loading to correctly re-assign
parents to boxes after deserializing them.

this bug is what happens when you commit without testing for more than a
few seconds.
2023-06-28 15:15:19 +02:00
HyperOnion 41b9ab7a2e fix worlds with boxes not saving & loading due to cyclic references. 2023-06-28 15:15:19 +02:00
HyperOnion 17ad391731 add autosave and world reset button. 2023-06-28 15:15:19 +02:00
HyperOnion 229e7471ef fix unnoticeable bug in world creation code. 2023-06-28 15:15:19 +02:00
HyperOnion 7299916fa7 implement saving and loading world data to file. 2023-06-28 15:15:19 +02:00
HyperOnion e40eede84d handle out of bounds positions in tile manipulation functions. 2023-06-24 14:15:27 +02:00
HyperOnion 68c93726f0 refactor world code to no longer assume the player entity:s pov. 2023-06-24 14:15:27 +02:00
HyperOnion c8e8d7eb70 begin refactoring movement logic out of player code into entity code. 2023-06-24 14:15:27 +02:00
HyperOnion f7caf8a3a8 implement basic box functionality. 2023-06-24 14:15:27 +02:00
HyperOnion b4976a0d94 basic player movement and general cleanup. 2023-06-24 14:15:27 +02:00