Mercurial > mamba
changeset 594:3fdbde59dc8a
Correct new tile calculation to use integer division (as was always intended for snakes).
author | Simon Cross <hodgestar@gmail.com> |
---|---|
date | Sat, 14 Jan 2023 17:19:23 +0100 |
parents | 72539d49c426 |
children | f27494691c0b |
files | mamba/snake.py |
diffstat | 1 files changed, 2 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/mamba/snake.py Wed Jan 11 21:07:25 2023 +0200 +++ b/mamba/snake.py Sat Jan 14 17:19:23 2023 +0100 @@ -271,7 +271,7 @@ # (Tri-state logic is the mamba's natural habitat) if dx != 0: newdx = rx + ds * dx - newtx = newdx / TX + newtx = newdx // TX if newtx > tx: self.set_tile_pos((tx + 1, ty)) ds = newdx - self.rect.left @@ -282,7 +282,7 @@ return True, ds else: newdy = ry + ds * dy - newty = newdy / TY + newty = newdy // TY if newty > ty: self.set_tile_pos((tx, ty + 1)) ds = newdy - self.rect.top