ineTo(tr[0], tr[1])
        canvas.lineTo(br[0], br[1])
        canvas.lineTo(bl[0], bl[1])
        canvas.fillStyle = linGrad
        canvas.fill()
        map.lineTo(playerPos[0] *8 + cos(theta1) * (wall[i + 1]) * 8,
            playerPos[1] * 8 + sin(theta1) * (wall[i + 1]) * 8)
        map.lineTo(playerPos[0] * 8 + cos(theta2) * (wall[i + 3]) * 8,
            playerPos[1] * 8 + sin(theta2) * (wall[i + 3]) * 8)

    map.fillStyle = "#FF0000"
    map.fill()

nbnw = 0
def nearWall(x,y):
    # check if poin