Matrix camera, movement concept

Hi, I was talking to some guy. He said that my movement concept in game is bad. When left or right arrow is pressed I’m scrolling background what makes you feel that player is moving (player’s X remains same).
So… he told me something about matrix view. I should create all walls and platforms static and scroll only the camera and move player’s rectangle.
I did a little research in Google, but nothing found.
Can you tell me anything about it? How to start? Maybe links, books and resources?
My programming language is Java (2d).

Thank you!

Hello!
Do you use the Lightweight Java Game Library?

No, I’m using only Java2D.
And thank you for fast response :slight_smile:

You should move the player and not the background. When drawing the objects to the screen (platforms, walls, enemies, etc.) you can translate the graphics context to move the camera to the right spot. e.g. The upper left corner of your world has the coordinates (0,0), your player is at (2000,500) and your game runs in a window with a size of 800*600. Every time you draw a frame you calculate the coordinates of the camera. If the player should always appear in the middle of the screen the camera might be at (1600,0). Then you simply translate the graphics object to those coordinates.

g.translate(1600,0);

and then you can draw the player and all the objects using their real coordinates.

Thank you! :slight_smile:
Now I can go back implement more physics and monsters.