I have a map file where the location of all objects on the stage is indicated, I load it and add objects to the stage with the following method in the GameMap class:
I want to check the position of objects (including moving ones) in the player component when moving the player in order to simulate the player’s physics
the cleaner choice is almost always one way data flow, from top to bottom. reaching upwards or backwards to fetch other objects is two way data flow and it’s always going to blow or cause a mess. the key is state management. the data is in your state model and the objects merely listen and react to it. since everything gets to access the state model you have the full picture at all times.