trezy-studios / wgd-open-jam

https://wgd-open-jam.vercel.app
BSD 3-Clause "New" or "Revised" License
2 stars 0 forks source link

Fix player position initialisation #19

Open trezy opened 1 year ago

trezy commented 1 year ago

To get the player in the "right position," we currently have to do a weird additional multiplication. @Tresky may have some more context on what's going on.

https://github.com/trezy-studios/wgd-open-jam/blob/main/src/game/systems/initialisationSystem.js#L47-L50

Tresky commented 1 year ago

I just pushed a commit to address this issue. When I wrote this code, I guess I was accidentally performing the conversion from pixels to meters (Rapier works in meters) twice. The conversion factor is 8px to 1meter, so the initial position was getting divided by 8 twice which is why you are multiplying by 8 twice in the beginning.

You should only now have to multiple by 8 one time: TILE_X TILE_WIDTH, TILE_Y TILE_HEIGHT, where TILE_X and TILE_Y are both 8.