Hello!
I have an issue moving an object in a 2d world. A little about the project:
I am building a game for which:
- the game is a top-down 2d shooter
- I create the map from a tmx file
- I have a "physics world" and a graphical world
- the "physics world" is just a collision detector and just some objects which I translate, rotate, etc. Nothing fancy. All was coded by me, but it works fine.
- the graphical world is represented by objects I just paint on the screen using the Java Graphics API
The big problem is the movement, translation, movement of camera.
Currently, I have come up with the solution that I will not move the main player (my player) in order to keep him on the screen. I move all other objects relatively to him.
However, now that I have implemented the "respawn logic", it is hard to move the translation offset to the new main player coordinates.
I am absolutely sure that there is a better solution and I would like you guys to tell me how you do it. Currently, the biggest problem is that I have to move 200 objects relatively to the main player coordinates. For now, it works smoothly, but I believe it is a bad idea. Also, everything is built from scratch and I do not use any frameworks like LibGDX.
Any suggestions?