add flr function to deal with something like a z-ziggling: the red ball may stick to one of the border and keep ziggling since the float point arithmetics. I modify these two lines to solve this issue: --bounce if flr(x) < 0 or flr(x) > 127 then vx = -vx end if flr(y) < 0 or flr(y) > 127 then vy = -vy end
my object manages to go beyond 0 and 127 on the x and y sometimes and it gets stuck (like what happened with yours) I tried to implement a for loop to check incrementally whether it is colliding with the wall using your box_hit function and collision video, but I don't think I did it properly damnit! back to the drawing board, oh well. thank you for your videos though they're great!
that was really helpful and so are other videos, thanks!
add flr function to deal with something like a z-ziggling: the red ball may stick to one of the border and keep ziggling since the float point arithmetics. I modify these two lines to solve this issue:
--bounce
if flr(x) < 0 or flr(x) > 127 then vx = -vx end
if flr(y) < 0 or flr(y) > 127 then vy = -vy end
my object manages to go beyond 0 and 127 on the x and y sometimes and it gets stuck (like what happened with yours) I tried to implement a for loop to check incrementally whether it is colliding with the wall using your box_hit function and collision video, but I don't think I did it properly
damnit! back to the drawing board, oh well.
thank you for your videos though they're great!