Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def move_single_axis(self, dx, dy):
- self.rect.x += dx
- self.rect.y += dy
- tx, ty = int(player.rect.x / 16), int(player.rect.y / 16)
- rects = [[tx, ty],[tx + 1, ty],[tx, ty + 1],[tx + 1, ty + 1]]
- for h in rects:
- if walls[int(h[0])][int(h[1])].tNum == 1:
- wam = walls[int(h[0])][int(h[1])].rect
- if self.rect.colliderect(wam):
- if dx > 0:
- self.rect.right = wam.left
- if dx < 0:
- self.rect.left = wam.right
- if dy > 0:
- self.rect.bottom = wam.top
- global jump
- jump = 0
- speed[1] = 0
- if dy < 0:
- self.rect.top = wam.bottom
- speed[1] = 0
- return
Add Comment
Please, Sign In to add comment