[BUG] rounding error when rendering sprites

ezgif-83fc3a8441e4f2a9

@richard , I think the sprite’s rendering is using the wrong rounding (Its using x|0 but I think it needs to use Math.round(x),or the opposite for collisions), and it creates that bug. On a wall facing right, the player goes through it. On the wall facing left, the player walks on the air.

(the video quality is bad bc it’s a gif)

6 Likes

What exactly does that mean? I know this is like galaxies too ahead of my level, but it sounds interesting and I want to know.

nope, this is intended. we don’t use round because it’s slower

2 Likes

looked at the code a little bit, and (v + 128) >> 8 the number:

@AlexK edit (forgot “rounds”):

looked at the code a little bit, and (v + 128) >> 8 rounds the number: