As frob was trying to tell you, pixels are not your units of measurement.
Pixels are used to measure things on the screen, which is completely separate from where things are in the game world.
This should be obvious when you consider that the camera can go up and down, and then suddenly, “I should put my player at 135 pixels,” has no meaning. Plus different resolutions. If the player’s screen doubles in size, the ground should be 270 pixels tall.
It clearly does not make sense to keep track of the player’s position (or any other objects’ positions) in pixels.
You have a game world on a static coordinate plane set.
Separately you have a camera with its own width, height, X, and Y. A scaling factor would be derived to indicate the ratio between your desired size and the actual size.
You convert from the game coordinate to the screen coordinates every frame.
All game logic takes place in the game world (not the screen world) using fixed predetermined sizes etc. There is just a conversion for rendering. That is all.
Yes! I realized that a few minutes when I did the last quote. I mixed the pixel and the position unit because I'm doing my background in Photoshop and the ground are 135px in the software so in the game programming I'm basing the units with the pixels of the image, if you understand me.
Reformulating my question, I just wonder if it's good practice positioning my elements on the screen with arbitrary units or using relative positions (if there's another technic to use).