#init
import pygame, sys
from pygame.locals import *

#constants
MAP_WIDTH = 1000
MAP_HEIGHT = 1000

camera = [0, 0]

#each tiles 100 x 100 so we will have 10 x 10 tiles
map = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
       [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
       [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
       [0, 1, 1, 1, 0, 0, 1, 1, 1, 0],
       [0, 0, 0, 1, 0, 0, 1, 0, 0, 0],
       [0, 0, 0, 1, 0, 0, 1, 0, 0, 0],
       [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
       [0, 0, 1, 0, 0, 0, 0, 1, 0, 0],
       [0, 0, 1, 0, 0, 0, 0, 1, 0, 0],
       [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]

def load_map(screen, player):

    #remember to offset all tiles
    camera[0] = player[0] - 500 // 2
    camera[1] = player[1] - 500 // 2
    
    y = 0

    #only will draw a tile where there is 1 in our grid
    for row in map:
        x = 0
        for tile in row:
            if tile == 1:
                pygame.draw.rect(screen, "light pink", (x * 100-camera[0], y  * 100-camera[1], 100, 100))
            x+= 1
        y+= 1

