diff --git a/assets/floor.png b/assets/floor.png index 38a0f84..52b029c 100644 Binary files a/assets/floor.png and b/assets/floor.png differ diff --git a/assets/wall_0.png b/assets/wall_0.png index fcbc193..1edf734 100644 Binary files a/assets/wall_0.png and b/assets/wall_0.png differ diff --git a/src/game.py b/src/game.py index def3851..043fbb1 100644 --- a/src/game.py +++ b/src/game.py @@ -32,7 +32,7 @@ map.generate() # Player player = Player() player.sprite.texture = spritesheet.SpriteSheet(assets.get("character.png"), 16, 24) -player.sprite.set_rect((0, 16, 16, 24)) +player.sprite.set_rect((0, 8, 16, 24)) # TODO: Scale character up x2 (1.5m) # TODO: Use asset loader for spritesheets player.sprite.texture.set_animation(0, 0, 0) @@ -42,7 +42,6 @@ player.set_pos(map.generator.rooms[0].x + 2, map.generator.rooms[0].y + 2) CENTER = [winsize[0] / 2, winsize[1] / 2] BGCOLOR = pygame.Color("#3e1202") - arial = pygame.font.SysFont("Arial", 10) # Mainloop diff --git a/src/map.py b/src/map.py index 670ece4..916e47c 100644 --- a/src/map.py +++ b/src/map.py @@ -20,7 +20,6 @@ class Map: # self.placer = loot.Placer() # self.map = self.placer.populate(self.map) - # TODO: Dont use rect h/w, use corners x/y def collides(self, pos, rect): px = int(math.floor(pos.x)) py = int(math.floor(pos.y)) @@ -29,8 +28,8 @@ class Map: if y >= 0 and y < len(self.map[1]) and x >=0 and x < len(self.map[1][y]): tile = self.map[1][y][x] if tile and tile.is_solid(): - if pos.x + (rect.width / self.METER) >= x and pos.x <= (x + 1) and \ - pos.y + (rect.height / self.METER) >= y and pos.y <= (y + 1): + if pos.x + (rect[2] / self.METER) >= x and pos.x + (rect[0] / self.METER) <= (x + 1) and \ + pos.y + (rect[3] / self.METER) >= y and pos.y + (rect[1] / self.METER) <= (y + 1): return True return False